[Gllug] mallinfo

Kostas Georgiou k.georgiou at imperial.ac.uk
Tue Oct 30 22:44:40 UTC 2007


On Tue, Oct 30, 2007 at 07:15:41PM +0000, Martin A. Brooks wrote:

> - Tethys wrote:
> > Since you've stated the goal is to keep track of the total amount of
> > memory malloc()ed, then the sum of the two fields is what you're
> > looking for. Explicitly checking for zero in arena could lead to all
> > sorts of interesting behaviour. Consider the case where most of the
> > memory is allocated with mmap(2), but a small amount is allocated with
> > sbrk(2), for example.
> 
> The correct solution is, of course, to write your code in a language 
> with automatic memory management.

Right, like python for example where the pymalloc memory allocator (only
used for objects less than 256 bytes thankfully) never bothered to free
any memory at all until recently (http://evanjones.ca/python-memory.html
for the details).

Having a language that has some form of automatic memory management doesn't
mean that it's done in a sane way.

Kostas
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list