[PATCH] Fix malloc_info statistic.

Carlos O'Donell carlos@redhat.com
Fri Nov 1 14:20:00 GMT 2013


On 11/01/2013 06:16 AM, Ondřej Bílka wrote:
> Hi, malloc_info could currently produce outputs like:
> 
> ... snip
> <size from="32785" to="32785" total="32785" count="1"/>
> <size from="2512305" to="2512305" total="2512305" count="1"/>
> <unsorted from="8993" to="8386112020140800621"
> total="8316306148830692230" count="7526394837682317685"/>
> </sizes>
> 
> Bogus numbers in unsorted field are caused by that when we 
> compute count we do not initialize sizes[NFASTBINS].count to zero.
> 
> A computation of these duplicates computation for rest of bins that is
> just below. Handling first bin by this case fixes initialization issues.
> 
> OK to commit?
> 
> 	* malloc/malloc (malloc_info): Do not handle first bin as
> 	special case.

This looks good to me. As far as I can tell it's duplicated code for no
reason and the normal case below handles initialization of 0 to the
required fields.

This is a user-visible issue, please file a bug for this, and then checkin
the fix with that bug number.

Cheers,
Carlos.



More information about the Libc-alpha mailing list