I'm calling malloc_info(3)
and getting XML output.
Everything I've found online says something along the lines of "this is subject to change and we're not gonna bother documenting it".
But that's not terribly useful for someone investigating a potential memory fragmentation issue.
Here are some snippets:
<malloc version="1">
<heap nr="0">
<sizes>
<size from="257" to="257" total="257" count="1"/>
</sizes>
<total type="fast" count="0" size="0"/>
<total type="rest" count="1" size="257"/>
<system type="current" size="303104"/>
<system type="max" size="303104"/>
<aspace type="total" size="303104"/>
<aspace type="mprotect" size="303104"/>
</heap>
<heap nr="1">
<sizes>
<size from="17" to="32" total="96" count="3"/>
<!-- etc. -->
<size from="10609" to="10609" total="10609" count="1"/>
<unsorted from="145" to="209" total="740" count="4"/>
</sizes>
<total type="fast" count="95" size="7328"/>
<total type="rest" count="2633564" size="112589836"/>
<system type="current" size="2032623616"/>
<system type="max" size="2032947200"/>
<aspace type="total" size="19451904"/>
<aspace type="mprotect" size="19775488"/>
</heap>
etc., etc., until...
<heap nr="27">
<sizes>
</sizes>
<total type="fast" count="0" size="0"/>
<total type="rest" count="0" size="0"/>
<system type="current" size="32768"/>
<system type="max" size="32768"/>
<aspace type="total" size="32768"/>
<aspace type="mprotect" size="32768"/>
</heap>
<total type="fast" count="4232" size="293312"/>
<total type="rest" count="22498068" size="1597097332"/>
<system type="current" size="17265770496"/>
<system type="max" size="17271173120"/>
<aspace type="total" size="491339776"/>
<aspace type="mprotect" size="496742400"/>
</malloc>
What does this all actually mean?
I'll put some of my own notes/thoughts in an answer, but I'd appreciate it if someone who knew more than I do would chip in.
ldd --version
reports Ubuntu EGLIBC 2.19-0ubuntu6.13
, which is the best guess I've got for the glibc version.
I've tagged this with eglibc because it's taken from Ubuntu 14.04, but it's probably relevant to glibc as well.
The diagram at http://core-analyzer.sourceforge.net/index_files/Page335.html is fairly useful.
Things I'm pretty sure of:
Heap 0 is the main arena.
current
, max
, total
and mprotect
is.Other heaps are numbered starting at 1.
Heap 1:
fast
and rest
track the total size of the free blocks: fast.count + rest.count == SUM(size.count)
and fast.size + rest.size == SUM(size.total)
Heap 27:
Totals?
That last number doesn't look reliable; if I total up the used memory (through other means), I get ~3GiB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With