|Description||OSD_MemInfo returns negative values for MemHeapUsage counter on Linux when exceeding 2GB:|
Draw> Private memory: 6011 MiB
Working Set: 6054 MiB (peak: 6108 MiB)
Virtual memory: 6297 MiB
Heap memory: -362 MiB
This is because implementation relies on obsolete GLibc-specific function mallinfo() returning 32-bit signed integer numbers.
Apart from overflow, mallinfo::uordblks is also known to return counter only for a first arena, while several arenas might be allocated - hence, unreliable for computing overall private allocations.
Unfortunately, there is no mallinfo() alternative compatible with 64-bit address space.
Instead, there are other functions available like malloc_info() returning memory info in an XML form.
int malloc_info(int options, FILE *stream);
Some applications implement an XML parser (with help of open_memstream() for creation of in-memory file).
While this could be slower than mallinfo() call, it seems this is the only way for computing reliable Heap values.