[Gllug] mallinfo

Andrew Roberts ar at nooneishere.co.uk
Tue Oct 30 12:20:52 UTC 2007


On 30/10/2007, t.clarke <tim at seacon.co.uk> wrote:
> The following 'test' program works on a Unix system correctly,
> but on a LInux system (debian), it reports the final 'alloc' line
> (after calling mallinfo) as ZERO  !!
>
> I cannot for the life of me see what is wrong.
>
> Any suggestions (or do I have a buggy glib ?)

You can use gdb to good effect to show you the contents of the
mallinfo struct. Check out the following:

$ gdb ./test
(gdb) break test.c:22
Breakpoint 1 at 0x804848f: file test.c, line 22.
(gdb) r
Starting program: /home/ar/test
mema -1212125176
memb -1215332344
memc -1218535416
alloc 6410240

Breakpoint 1, main (argc=1, argv=0xbfe21594) at test.c:22
22          printf("alloc %ld\n",mallinf.arena);
(gdb) p mallinf
$1 = {arena = 0, ordblks = 1, smblks = 0, hblks = 3, hblkhd = 9609216,
  usmblks = 0, fsmblks = 0, uordblks = 0, fordblks = 0, keepcost = 0}

Regards,
Andrew.
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list