Previous | Next --- Slide 31 of 48
Back to Lecture Thumbnails
neonachronism

I've heard that before valgrind, it was simply considered acceptable to have a number of memory leaks or illegal (but not SIGSEGV inducing) accesses - they were simply too difficult to find. Is there any truth to this?

tommywow

I heard this from professor Kesden from 15-213. He said that before Valgrind, some people would print out pointer address information in the program to debug any Segfault or Memory leaks. It sounds like a lot of work!

amolakn

What's the difference between definitely lost, indirectly lost, and possibly lost?

bpr

@amolakn, Valgrind is also tracking what values are stored in every memory location, so it can identify if any pointer values exist. Indirectly lost are blocks where pointers exist to the block, but those pointers are in lost blocks (e.g., the root node is lost and the rest of the tree is indirectly lost). Possibly lost are blocks where a pointer (or value that looks like a pointer) points to the middle of an allocated block, so a programmer might be able to reconstruct the block itself.

Valgrind Docs

ferozenaina

An issue I've had - your program may behave differently when using valgrind or gdb due to the slowdown and serialized execution. Valgrind runs it under a different environment. It also monitors and remaps memory layout. This may cause programs to work correctly in valgrind when they normally segfault. This is called a Heisenbug! Usually caused due to an invalid memory read/write.