64-bit mallinfo alternative?

On Linux, we have this (GNU C library) function called mallinfo , which gives you some numbers related to memory allocation:

 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) */
       };

Oddly enough, these values ​​are usually 32-bit integers (!); well, that really will not be done, especially for values ​​given in the number of bytes (for example, fordblks).

I would suggest that this is somehow outdated, and that some other object is available to get the same information. What is this alternative object?

+4
source share
1 answer

malloc_info(). xml.
malloc_info:

malloc_info() malloc_stats (3) mallinfo (3).

malloc_info - , ,  . size_t , -.

. ( glibc 2.26) malloc_info(0, stdout) :

<malloc version="1">
<heap nr="0">
<sizes>
</sizes>
<total type="fast" count="0" size="0"/>
<total type="rest" count="0" size="0"/>
<system type="current" size="135168"/>
<system type="max" size="135168"/>
<aspace type="total" size="135168"/>
<aspace type="mprotect" size="135168"/>
</heap>
<total type="fast" count="0" size="0"/>
<total type="rest" count="0" size="0"/>
<total type="mmap" count="0" size="0"/>
<system type="current" size="135168"/>
<system type="max" size="135168"/>
<aspace type="total" size="135168"/>
<aspace type="mprotect" size="135168"/>
</malloc>
+1

Source: https://habr.com/ru/post/1662348/


All Articles