Thanks John.

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.

Does Valgrind, by any chance, have its own set of non-standard hooks?
That would be a good solution for me.
I looked in the source code and documentation, but could only find
hooks that notify Valgrind about memory.

On Fri, Oct 19, 2012 at 7:52 PM, John Reiser <[email protected]> wrote:
>> Or even better, how can I successfully use __malloc_hook while running
>> under Valgrind?
>
> You cannot.  "man 3 malloc_hook" says "These functions are GNU extensions."
> Memcheck's implementation of malloc has "nothing to do" with glibc's
> implementation, except of course the C89/C99 syntax and semantics,
> which do not include __malloc_hook.  Using something such as __malloc_hook
> presumes that you have an agreement with the implementor of malloc,
> and obviously you don't have that agreement when malloc is implemented
> by memcheck.  (The "__" double underscore prefix to '__malloc_hook'
> *tells* you that you are doing something "naughty"; read the standard!)
>
> In order to use memcheck, then the program must use only the standard
> semantics of malloc, free, calloc, realloc, memalign, posix_memalign.
> Also see the NOTES: "The use of these hook functions is not safe in
> multithreaded programs, and they are now deprecated."
>
> --
>
>
> ------------------------------------------------------------------------------
> 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

------------------------------------------------------------------------------
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