[Gllug] mallinfo

- Tethys tethys at gmail.com
Tue Oct 30 13:12:08 UTC 2007


On 10/30/07, t.clarke <tim at seacon.co.uk> wrote:

> Since the code needs to run on both Unix and Linux I guess I will need to
> test if 'arena' is zero and if so report on 'hblkhd' instead, or maybe
> play safe and simply add both values together !

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.

Tet

-- 
Perl is like vise grips. You can do anything with it but it is the
wrong tool for every job. -- Bruce Eckel
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list