1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Add mallinfo2 function that support sizes >= 4GB.

The current int type can easily overflow for allocation of more
than 4GB.
This commit is contained in:
Martin Liska
2020-07-07 13:58:24 +02:00
parent 85f1848937
commit e3960d1c57
3 changed files with 69 additions and 23 deletions

View File

@ -97,9 +97,30 @@ struct mallinfo
int keepcost; /* top-most, releasable (via malloc_trim) space */
};
/* SVID2/XPG mallinfo2 structure which can handle allocations
bigger than 4GB. */
struct mallinfo2
{
size_t arena; /* non-mmapped space allocated from system */
size_t ordblks; /* number of free chunks */
size_t smblks; /* number of fastbin blocks */
size_t hblks; /* number of mmapped regions */
size_t hblkhd; /* space in mmapped regions */
size_t usmblks; /* always 0, preserved for backwards compatibility */
size_t fsmblks; /* space available in freed fastbin blocks */
size_t uordblks; /* total allocated space */
size_t fordblks; /* total free space */
size_t keepcost; /* top-most, releasable (via malloc_trim) space */
};
/* Returns a copy of the updated current mallinfo. */
__MALLOC_DEPRECATED;
extern struct mallinfo mallinfo (void) __THROW;
/* Returns a copy of the updated current mallinfo. */
extern struct mallinfo2 mallinfo2 (void) __THROW;
/* SVID2/XPG mallopt options */
#ifndef M_MXFAST
# define M_MXFAST 1 /* maximum request size for "fastbins" */