[Gllug] mallinfo

Nix nix at esperi.org.uk
Tue Oct 30 21:10:00 UTC 2007


On 30 Oct 2007, Martin A. Brooks said:

> - 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.

It's very likely that this, too, will end up calling malloc() somewhere
down the road (or mmap() directly); if it doesn't, it almost certainly
should. glibc malloc() is really very efficient as these things go.

-- 
`Some people don't think performance issues are "real bugs", and I think 
such people shouldn't be allowed to program.' --- Linus Torvalds
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list