| 1 |
'\" t |
| 2 |
.\" Copyright 2012, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH malloc_stats 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
malloc_stats \- print memory allocation statistics |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <malloc.h> |
| 16 |
.P |
| 17 |
.B void malloc_stats(void); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR malloc_stats () |
| 22 |
function prints (on standard error) statistics about memory allocated by |
| 23 |
.BR malloc (3) |
| 24 |
and related functions. |
| 25 |
For each arena (allocation area), this function prints |
| 26 |
the total amount of memory allocated |
| 27 |
and the total number of bytes consumed by in-use allocations. |
| 28 |
(These two values correspond to the |
| 29 |
.I arena |
| 30 |
and |
| 31 |
.I uordblks |
| 32 |
fields retrieved by |
| 33 |
.BR mallinfo (3).) |
| 34 |
In addition, |
| 35 |
the function prints the sum of these two statistics for all arenas, |
| 36 |
and the maximum number of blocks and bytes that were ever simultaneously |
| 37 |
allocated using |
| 38 |
.BR mmap (2). |
| 39 |
.SH ATTRIBUTES |
| 40 |
For an explanation of the terms used in this section, see |
| 41 |
.BR attributes (7). |
| 42 |
.TS |
| 43 |
allbox; |
| 44 |
lbx lb lb |
| 45 |
l l l. |
| 46 |
Interface Attribute Value |
| 47 |
T{ |
| 48 |
.na |
| 49 |
.nh |
| 50 |
.BR malloc_stats () |
| 51 |
T} Thread safety MT-Safe |
| 52 |
.TE |
| 53 |
.SH STANDARDS |
| 54 |
GNU. |
| 55 |
.SH HISTORY |
| 56 |
glibc 2.0. |
| 57 |
.SH NOTES |
| 58 |
More detailed information about memory allocations in the main arena |
| 59 |
can be obtained using |
| 60 |
.BR mallinfo (3). |
| 61 |
.SH SEE ALSO |
| 62 |
.BR mmap (2), |
| 63 |
.BR mallinfo (3), |
| 64 |
.BR malloc (3), |
| 65 |
.BR malloc_info (3), |
| 66 |
.BR mallopt (3) |