> I was willing to go with the "naughty" way and whatever workarounds it
> required, if it meant not having to start wrapping all of our
> allocations.

The intended way to do this is by "intercepting", "superseding",
or "over-riding" the symbol 'malloc':  Make your own shared library
containing a malloc() routine, and load it into your app via
environment variable LD_PRELOAD, so that calls from the app to
malloc() go to your LD_PRELOADed library.  Your malloc can do
whatever it wants, probably including finding the "real" malloc
by dlsym(RTLD_NEXT, "malloc") and calling that as a subroutine.
See the manual page for dlsym.  Remember to "#define _GNU_SOURCE 1"
before "#include <dlfcn.h>".

-- 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to