Get memory allocation information


#include <malloc.h>

struct mallinfo mallinfo ( void );



Use the -l c option to qcc to link against this library. This library is usually included automatically.


The mallinfo() function returns memory-allocation information in the form of a struct mallinfo:

struct mallinfo {
    int arena;    /* size of the arena */
    int ordblks;  /* number of big blocks in use */
    int smblks;   /* number of small blocks in use */
    int hblks;    /* number of header blocks in use */
    int hblkhd;   /* space in header block headers */
    int usmblks;  /* space in small blocks in use */
    int fsmblks;  /* memory in free small blocks */
    int uordblks; /* space in big blocks in use */
    int fordblks; /* memory in free big blocks */
    int keepcost; /* penalty if M_KEEP is used -- not used */
Note: Because the members of this structure are of type int, they might overflow if you're working with allocations that are larger than 2 GB. Instead of using mallinfo(), call mallopt() with the MALLOC_STATS command.


A struct mallinfo.


Legacy Unix

Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes