The mallinfo() function returns a copy of a structure containing
information about memory allocations performed by malloc(3) and
related functions.
Note that not all allocations are visible to mallinfo(); see BUGS and
consider using malloc_info(3) instead.
The returned structure is defined as follows:
struct mallinfo {
int arena; /* Non-mmapped space allocated (bytes) */
int ordblks; /* Number of free chunks */
int smblks; /* Number of free fastbin blocks */
int hblks; /* Number of mmapped regions */
int hblkhd; /* Space allocated in mmapped regions (bytes) */
int usmblks; /* Maximum total allocated space (bytes) */
int fsmblks; /* Space in freed fastbin blocks (bytes) */
int uordblks; /* Total allocated space (bytes) */
int fordblks; /* Total free space (bytes) */
int keepcost; /* Top-most, releasable space (bytes) */
};
The fields of the mallinfo structure contain the following informa‐
tion:
arena The total amount of memory allocated by means other than
mmap(2) (i.e., memory allocated on the heap). This figure
includes both in-use blocks and blocks on the free list.
ordblks The number of ordinary (i.e., non-fastbin) free blocks.
smblks The number of fastbin free blocks (see mallopt(3)).
hblks The number of blocks currently allocated using mmap(2).
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
hblkhd The number of bytes in blocks currently allocated using
mmap(2).
usmblks The "highwater mark" for allocated space—that is, the maxi‐
mum amount of space that was ever allocated. This field is
maintained only in nonthreading environments.
fsmblks The total number of bytes in fastbin free blocks.
uordblks The total number of bytes used by in-use allocations.
fordblks The total number of bytes in free blocks.
keepcost The total amount of releasable free space at the top of the
heap. This is the maximum number of bytes that could ide‐
ally (i.e., ignoring page alignment restrictions, and so
on) be released by malloc_trim(3).

For an explanation of the terms used in this section, see
attributes(7).
┌───────────┬───────────────┬──────────────────────────────┐
│Interface │ Attribute │ Value │
├───────────┼───────────────┼──────────────────────────────┤
│mallinfo() │ Thread safety │ MT-Unsafe init const:mallopt │
└───────────┴───────────────┴──────────────────────────────┘
mallinfo() would access some global internal objects. If modify them
with non-atomically, may get inconsistent results. The identifier
mallopt in const:mallopt mean that mallopt() would modify the global
internal objects with atomics, that make sure mallinfo() is safe
enough, others modify with non-atomically maybe not.

Information is returned for only the main memory allocation area.
Allocations in other arenas are excluded. See malloc_stats(3) and
malloc_info(3) for alternatives that include information about other
arenas.
The fields of the mallinfo structure are typed as int. However,
because some internal bookkeeping values may be of type long, the
reported values may wrap around zero and thus be inaccurate.

This page is part of release 5.01 of the Linux man-pages project. A
description of the project, information about reporting bugs, and the
latest version of this page, can be found at
https://www.kernel.org/doc/man-pages/.
Linux 2019-03-06 MALLINFO(3)