---
name: "malloc_stats"
section: "3"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/malloc_stats"
---

# malloc\_stats(3)

print memory allocation statistics

## NAME

malloc\_stats - print memory allocation statistics

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <malloc.h>
```

**void malloc\_stats(void);**

## DESCRIPTION

The **malloc\_stats**() function prints (on standard error) statistics about memory allocated by [**malloc**(3)](/malloc/3.md) and related functions. For each arena (allocation area), this function prints the total amount of memory allocated and the total number of bytes consumed by in-use allocations. (These two values correspond to the *arena* and *uordblks* fields retrieved by [**mallinfo**(3)](/mallinfo/3.md).) In addition, the function prints the sum of these two statistics for all arenas, and the maximum number of blocks and bytes that were ever simultaneously allocated using [**mmap**(2)](/mmap/2.md).

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **malloc\_stats**() | Thread safety | MT-Safe |

## STANDARDS

GNU.

## HISTORY

glibc 2.0.

## NOTES

More detailed information about memory allocations in the main arena can be obtained using [**mallinfo**(3)](/mallinfo/3.md).

## SEE ALSO

[**mmap**(2)](/mmap/2.md), [**mallinfo**(3)](/mallinfo/3.md), [**malloc**(3)](/malloc/3.md), [**malloc\_info**(3)](/malloc_info/3.md), [**mallopt**(3)](/mallopt/3.md)
