#2352: support 64 bit numbers for SystemStatistic's malloc'ed memory size
| Reporter: | |
| Status: | new |
| Milestone: | |
| Version: | |
| Type: | enhancement |
| Priority: | minor |
| Component: | EinsteinToolkit thorn |
The mallinfo(3) call used by SystemStatistics is limited to 32bit signed numbers and thus cannot record if more than 2GB of memory are used.
There is no direct 64bit equivalent, however there is a malloc_info function (http://man7.org/linux/man-pages/man3/malloc_info.3.html) which can be used, in combination with open_memstream(3) (http://man7.org/linux/man-pages/man3/open_memstream.3.html) to obtain an in-memory XML string containing the required information.
Looking at https://git.amper.me/open-source/glibc/blob/4d653a59ffeae0f46f76a40230e2cfa9587b7e7e/malloc/malloc.c#L5148 and how that same function computes uordblks the proper way to get a 64bit integer would seem to be to compute total_aspace - total_avail.
"Parsing" the XML string can be done using strstr(xml, "<aspace type=\"total\" size=\"") followed by an strtol.
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2352/support-64-bit-numbers-for