<html>#2352: support 64 bit numbers for SystemStatistic's malloc'ed memory size
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td></td></tr>
<tr><td style='text-align:right'>   Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td></td></tr>
<tr><td style='text-align:right'>     Type:</td><td>enhancement</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>EinsteinToolkit thorn</td></tr>
</table>

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