|
From: Samuel B. <na...@gm...> - 2009-07-27 01:14:40
|
At Wed, 22 Jul 2009 18:27:58 +0300, Ivan Ivanov wrote: > Hi, > > I wonder whether it is possible to rack the memory allocation/deallocation > in my application and all linked libraries by using Valgrind ? What do I > mean by that: I'd like to turn on some log that would write a memory > allocation in the following form: address, source file, source line of where > the allocation occurred (using C++ "new" operator, malloc, etc.). The same > is for deallocation (when using C++ "delete" operator, free, etc.). > > Just in case: the purpose why I need that is that I'd like to quickly find > the source line where the allocation (and possible deallocation if this is a > dangling pointer) of memory for some problematic object occurred. The point > is when there are a lot of unfamiliar code and you quickly need to find a > problem (the point where the object was created could really help), that > would be really good thing. You tried just running valgrind on it yet, or perhaps running valgrind with --leak-check=full? Valgrind's default "memcheck" skin is supposed to track all of the info you want, tracks all the information you want, except it doesn't avoid re-using deallocated blocks forever, so your dangling pointers might be an issue if they dangle to long before they get used again. To control how long these dangling pointers will be catchable, you could use the --freelist-vol flag. |