Click to See Complete Forum and Search --> : Memory profile Debug Tools for Linux
ouster
04-18-2002, 11:46 AM
Hi all,
I am trying to track down some nasty memory corruption in our software, unfortunately not all the tools out there are up to the job.
I have found and mostly given up on memprof, Checker, memwatch, and debauch, if anybody has heard of any others I would appreciate a reply or if anyone knows of a site that maintains a list that would be great.
P.s. Purify isn't available is it?
Cheers,
Colin Nevin
Senior Software Engineer,
Merit Solutions Ltd.
IRELAND
furrycat
04-18-2002, 09:12 PM
I knew my program had memory problems and I tried dmalloc and debauch to catch them ... without success. debauch was good but it would lose function names so you'd got this list of addresses where calls had been made but you didn't know what they were!
Then I came across valgrind. Search on freshmeat.net for it.
I can't overstate how cool this program is. I was able to track down and fix ALL my memory leaks in a very short space of time.
Check it out.
Sample output:
iain@castellane:~/scnhacking/latest$ valgrind --leak-check=yes --show-reachable=yes --num-callers=5 --verbose ./scnhacking missiona.scn
==1213== valgrind-20020315, a memory error detector for x86 GNU/Linux.
==1213== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==1213== Startup, with flags:
==1213== --suppressions=/usr/share/valgrind/linux24.supp
==1213== --leak-check=yes
==1213== --show-reachable=yes
==1213== --num-callers=5
==1213== -v
==1213== Reading suppressions file: /usr/share/valgrind/linux24.supp
==1213== Reading syms from /home/iain/scnhacking/scnhacking-0.5/scnhacking
==1213== Reading syms from /lib/ld-2.2.3.so
==1213== Reading syms from /usr/share/valgrind/valgrind.so
==1213== Reading syms from /lib/libc-2.2.3.so
==1213==
==1213== Use of uninitialised CPU condition code
==1213== at 0x804E60E: get_entclass (entclass.c:42)
==1213== by 0x804BDEE: classify_entity (entity.c:269)
==1213== by 0x804B5D8: find_entities (entity.c:129)
==1213== by 0x80495DC: parse_scn (scn.c:91)
==1213== by 0x8048EE1: main (main.c:62)
WARNING: entity 152 has no classname attribute
Summary of missiona.scn
Map entities: 304
Unique entity classes: 19
No lightmaps
Lights: 29
==1213==
==1213== ERROR SUMMARY: 304 errors from 1 contexts (suppressed: 0 from 0)
==1213==
==1213== 304 errors in context 1 of 1:
==1213== Use of uninitialised CPU condition code
==1213== at 0x804E60E: get_entclass (entclass.c:42)
==1213== by 0x804BDEE: classify_entity (entity.c:269)
==1213== by 0x804B5D8: find_entities (entity.c:129)
==1213== by 0x80495DC: parse_scn (scn.c:91)
==1213== by 0x8048EE1: main (main.c:62)
==1213== IN SUMMARY: 304 errors from 1 contexts (suppressed: 0 from 0)
==1213==
==1213== malloc/free: in use at exit: 6976 bytes in 304 blocks.
==1213== malloc/free: 13245 allocs, 12941 frees, 137409 bytes allocated.
==1213==
==1213== searching for pointers to 304 not-freed blocks.
==1213== checked 4006652 bytes.
==1213==
==1213== definitely lost: 6908 bytes in 302 blocks.
==1213== possibly lost: 0 bytes in 0 blocks.
==1213== still reachable: 68 bytes in 2 blocks.
==1213==
==1213== 68 bytes in 2 blocks are still reachable in loss record 1 of 2
==1213== at 0x40064F6D: malloc (vg_clientmalloc.c:589)
==1213== by 0x80502B7: alloc_lots (memory.c:8)
==1213== by 0x805133B: alloc_pairs (pair.c:4)
==1213== by 0x804B8B8: parse_entity (entity.c:181)
==1213== by 0x804B561: find_entities (entity.c:122)
==1213==
==1213== 6908 bytes in 302 blocks are definitely lost in loss record 2 of 2
==1213== at 0x40064F6D: malloc (vg_clientmalloc.c:589)
==1213== by 0x80502B7: alloc_lots (memory.c:8)
==1213== by 0x805133B: alloc_pairs (pair.c:4)
==1213== by 0x804B8B8: parse_entity (entity.c:181)
==1213== by 0x804B561: find_entities (entity.c:122)
==1213==
==1213== LEAK SUMMARY:
==1213== possibly lost: 0 bytes in 0 blocks.
==1213== definitely lost: 6908 bytes in 302 blocks.
==1213== still reachable: 68 bytes in 2 blocks.
==1213==
--1213-- dispatch: 1383891 basic blocks, 4012 tt_fast misses.
--1213-- translate: new 1626 (22931 -> 305118), discard 0 (0 -> 0).
--1213-- lru: 69 epochs, 0 clearings.
--1213-- reg-alloc: 360 t-req-spill, 57104+2098 orig+spill uis, 7591 total-reg-r.
--1213-- smc-check: 0 checks, 0 fast pass, 0 slow pass, 0 discards.
--1213-- sanity: 1364 cheap, 55 expensive checks.
Now I'm off to fix those bugs...
ouster
04-23-2002, 08:32 AM
Hi Thanks for that furrycat, it is the best free one I have seen! btw Insure++ Lite was distributed with RedHat 6.0 Application Cd for free. If I can track that down I am laughing. http://discussions.linuxplanet.com/smile.gif
C.
Originally posted by furrycat:
I knew my program had memory problems and I tried dmalloc and debauch to catch them ... without success. debauch was good but it would lose function names so you'd got this list of addresses where calls had been made but you didn't know what they were!
Then I came across valgrind. Search on freshmeat.net for it.
I can't overstate how cool this program is. I was able to track down and fix ALL my memory leaks in a very short space of time.
Check it out.
Sample output:
iain@castellane:~/scnhacking/latest$ valgrind --leak-check=yes --show-reachable=yes --num-callers=5 --verbose ./scnhacking missiona.scn
==1213== valgrind-20020315, a memory error detector for x86 GNU/Linux.
==1213== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==1213== Startup, with flags:
==1213== --suppressions=/usr/share/valgrind/linux24.supp
==1213== --leak-check=yes
==1213== --show-reachable=yes
==1213== --num-callers=5
==1213== -v
==1213== Reading suppressions file: /usr/share/valgrind/linux24.supp
==1213== Reading syms from /home/iain/scnhacking/scnhacking-0.5/scnhacking
==1213== Reading syms from /lib/ld-2.2.3.so
==1213== Reading syms from /usr/share/valgrind/valgrind.so
==1213== Reading syms from /lib/libc-2.2.3.so
==1213==
==1213== Use of uninitialised CPU condition code
==1213== at 0x804E60E: get_entclass (entclass.c:42)
==1213== by 0x804BDEE: classify_entity (entity.c:269)
==1213== by 0x804B5D8: find_entities (entity.c:129)
==1213== by 0x80495DC: parse_scn (scn.c:91)
==1213== by 0x8048EE1: main (main.c:62)
WARNING: entity 152 has no classname attribute
Summary of missiona.scn
Map entities: 304
Unique entity classes: 19
No lightmaps
Lights: 29
==1213==
==1213== ERROR SUMMARY: 304 errors from 1 contexts (suppressed: 0 from 0)
==1213==
==1213== 304 errors in context 1 of 1:
==1213== Use of uninitialised CPU condition code
==1213== at 0x804E60E: get_entclass (entclass.c:42)
==1213== by 0x804BDEE: classify_entity (entity.c:269)
==1213== by 0x804B5D8: find_entities (entity.c:129)
==1213== by 0x80495DC: parse_scn (scn.c:91)
==1213== by 0x8048EE1: main (main.c:62)
==1213== IN SUMMARY: 304 errors from 1 contexts (suppressed: 0 from 0)
==1213==
==1213== malloc/free: in use at exit: 6976 bytes in 304 blocks.
==1213== malloc/free: 13245 allocs, 12941 frees, 137409 bytes allocated.
==1213==
==1213== searching for pointers to 304 not-freed blocks.
==1213== checked 4006652 bytes.
==1213==
==1213== definitely lost: 6908 bytes in 302 blocks.
==1213== possibly lost: 0 bytes in 0 blocks.
==1213== still reachable: 68 bytes in 2 blocks.
==1213==
==1213== 68 bytes in 2 blocks are still reachable in loss record 1 of 2
==1213== at 0x40064F6D: malloc (vg_clientmalloc.c:589)
==1213== by 0x80502B7: alloc_lots (memory.c:8)
==1213== by 0x805133B: alloc_pairs (pair.c:4)
==1213== by 0x804B8B8: parse_entity (entity.c:181)
==1213== by 0x804B561: find_entities (entity.c:122)
==1213==
==1213== 6908 bytes in 302 blocks are definitely lost in loss record 2 of 2
==1213== at 0x40064F6D: malloc (vg_clientmalloc.c:589)
==1213== by 0x80502B7: alloc_lots (memory.c:8)
==1213== by 0x805133B: alloc_pairs (pair.c:4)
==1213== by 0x804B8B8: parse_entity (entity.c:181)
==1213== by 0x804B561: find_entities (entity.c:122)
==1213==
==1213== LEAK SUMMARY:
==1213== possibly lost: 0 bytes in 0 blocks.
==1213== definitely lost: 6908 bytes in 302 blocks.
==1213== still reachable: 68 bytes in 2 blocks.
==1213==
--1213-- dispatch: 1383891 basic blocks, 4012 tt_fast misses.
--1213-- translate: new 1626 (22931 -> 305118), discard 0 (0 -> 0).
--1213-- lru: 69 epochs, 0 clearings.
--1213-- reg-alloc: 360 t-req-spill, 57104+2098 orig+spill uis, 7591 total-reg-r.
--1213-- smc-check: 0 checks, 0 fast pass, 0 slow pass, 0 discards.
--1213-- sanity: 1364 cheap, 55 expensive checks.
Now I'm off to fix those bugs...