-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, On Tue, 30 Nov 2004, William A. Mahaffey III wrote:
.... I am trying to port some code (a Motif CAD/Grid-generator) from SGI to my SuSE 8.2 Linux box. Everything is coming fairly smoothly (actually DAMN smooth), except for 1 thing. The code is mostly C, with some leaf-FORTRAN. I use malloc/realloc & free to allocate & free mamory. I have found several places where I was calling free repeatedly with the same pointer (slides by on SGI, bombs under Linux) & corrected all of them so far. I have fixed all the simple/silly stuff (I think) & now need to go a bit deeper. I tried activating the documented memory debugging using '#define MALLOC_CHECK_' in my program main, but I get no diagnostics or core dump, just execution which gets to a specific line & hangs. I have also tried the mtrace facility, but just get mention of 3 hex addresses where memory is free'd that wasn't alloc'd. I think I am screwing something else up earlier, but can't get a core dump or any diagnostics to help me out. SGI has a nice & very handy memory debugger (malloc (3X)) which can be compiled in & activated at runtime as needed, ignored otherwise. I haven't found any such thing (yet) under Linux. My question is how do I get Linux to either dump core or give me some diagnostics (at every call to malloc or free, like SGI ;-) ) so I can find my more subtle screwups & fix them ? TIA
Take a look at Valgrind: http://valgrind.kde.org/ Bye, LenZ - -- - ------------------------------------------------------------------ Lenz Grimmer <lenz@grimmer.com> -o) [ICQ: 160767607 | Jabber: LenZGr@jabber.org] /\ http://www.lenzg.org/ V_V -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: For info see http://quantumlab.net/pine_privacy_guard/ iD8DBQFBru9+SVDhKrJykfIRAu4DAJ4o+Ybp0tsF5/yVYSZTK7XzwiDa6QCfa8ys SWAlv/Ui3QmaN3E800IqqaM= =hQ2o -----END PGP SIGNATURE-----