[Gllug] mallinfo
t.clarke
tim at seacon.co.uk
Wed Oct 31 09:11:36 UTC 2007
After reading all the various interesting posts concerning mallinfo I did some
more extensive googling last night on 'malloc' followed by some compilation
experimentation.
It indeed seems that malloc serves up chunks of memory using 'sbrk' memory
when requests are modest, and large chunks using 'mmap' memory. I guess my
original test program as just asking for too big a chunk!
I also discovered why my original approach which prompted the research was not
working. I originally simply wanted to check that a program wasnt getting too
big by possibly 'leaking' memory, so I periodically subtracted the 'starting'
sbrk value from the current 'sbrk' value, and was always getting zero, which
seemed weird.
My testing last night reveals that the malloc in use on my linux machine
creates an 'arena' of a whopping 135,168 bytes on the very first request;
and since all subsequent requests were being satisfied within that huge
block of memory, the returned value was always zero :-(
I have downloaded dlmalloc and statically compiled it into the test program
to see what difference it makes. Interestingly it only appears to expand
the sbrk value by a much more modest amount - rounded to the nearest 4k it
seems. It would seem that this version of malloc is much more 'user memory'
friendly!!
Tim
--------------------------------------------------------------------------------
This E-Mail (and any files transmitted with it) is intended solely for the use
of the individual or entity to whom it is addressed. If you have received it in
error please notify the sender and delete the message.
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list