|
From: Ivan I. <bar...@gm...> - 2009-07-22 16:04:09
|
Isn't wrapping *alloc/free and new/delete enough for that (i.e. can > you recompile all the allocators you need)? If yes, it's possible not > to use Valgrind at all. That's might be a solution, but what do you mean by "wrapping" ? Can you provide an example and generally the way how to do that ? If your solution supposes to somehow change the source code (for example by something like #define new debug_new) that can be hard taking into account that I link my application with a HUGE Qt library and that will need to make those changes throughout the whole Qt library source code and further recompilation that is not guarantee it will be successfully built then. Or there is come features in clib/libstdc++ that I don't know ? Can you hint me then ? I thought using Valgrind could help me to do that without any additional work as I believe it is not a problem for Valgrind to track the memory allocation/deallocation sources and for example turn on the log by some option. > > > You can also edit memcheck/mc_malloc_wrappers.c to add the necessary > functionality to Memcheck, I think. Thanks. I'll have a look > > > Alex > > > > 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. > > So is that (or at least anything close to what I need) possible using > > Valgrind ? > > Thanks > |