|
From: janjust <tja...@un...> - 2011-12-13 20:03:55
|
Hey group,
I'm wondering the it's possible to intercept the malloc calls without
having to call valgrind's malloc wrapper.
The reason being is that I'm noticing the wrapper allocating chunks in
different sizes than say glibc's malloc. For practical purposes I would only
like to record the return address of the malloc call and the block's size. I
hope this makes sense.
Thoughts?
--
View this message in context: http://old.nabble.com/malloc-wrappers-tp32970308p32970308.html
Sent from the Valgrind - Users mailing list archive at Nabble.com.
|
|
From: Julian S. <js...@ac...> - 2011-12-19 11:04:16
|
On Tuesday, December 13, 2011 09:04:09 pm janjust wrote: > Hey group, > I'm wondering if it's possible to intercept the malloc calls without > having to call valgrind's malloc wrapper. > The reason being is that I'm noticing the wrapper allocating chunks in > different sizes than say glibc's malloc. For practical purposes I would > only like to record the return address of the malloc call and the block's > size. I hope this makes sense. > Thoughts? You can probably do that, in the sense that the framework provides the necessary infrastructure. The basic thing you will need to do is change the malloc replacement functions into wrapper functions; see the section on function wrapping and interception in the user documentation. It may take quite a lot of work to do that, though. From a practical point of view, if you do something like this there is a significant risk that you will reduce memcheck's ability to detect errors. So the best advice is, imo, don't mess with it. J |