Re: Finding memory leak, walking the heap?



"Ed J" <jed@xxxxxxxxxxx> writes:

[...]

Essentially, I'm looking for the ability to do something like this:

long bytes_allocated = heap_space_used();
... run code here that shouldn't grow the heap
if (bytes_allocated != heap_space_used())
printf( "I found a leak");

mallinfo. You might also want to try valgrind. Actually, you almost
surely want to try valgrind. (Presuming you're using an architecture
supported by valgrind, of course.)
.



Relevant Pages

  • Re: mnemonic
    ... Ben Pfaff said: ... I'd say that about half of my bugs I find with printf. ... half, I find with valgrind. ...
    (comp.lang.c)
  • Re: mnemonic
    ... I'd say that about half of my bugs I find with printf. ... half, I find with valgrind. ... I find with a traditional debugger. ... Chuck F (cbfalconer at maineline dot net) ...
    (comp.lang.c)
  • Re: mnemonic
    ... I'd say that about half of my bugs I find with printf. ... half, I find with valgrind. ... "git bisect". ...
    (comp.lang.c)
  • Re: segmentation fault with printf
    ... > i have a weird problem with printf statement. ... I'm quite confident it's not printf, I have a test file which has ... if you happen to use linux you might wanna try out ... valgrind to inspect your program, ...
    (comp.lang.c)
  • Re: life expectancy of allocated resources in a .so file
    ... purify (same as valgrind for heap, slightly better for globals); ... In order to understand recursion you must first understand recursion. ...
    (comp.os.linux.development.apps)