[lttng-dev] [PATCH lttng-ust] Add trace support for calloc and realloc.
Stefan Seefeld
stefan_seefeld at mentor.com
Thu Aug 1 12:32:46 EDT 2013
Hi Alexander,
thanks for offering your advice.
On 08/01/2013 12:26 PM, Alexander Monakov wrote:
> Hi,
>
> I can offer two more possible approaches:
>
> 1. Use posix_memalign to obtain free()'able memory for calloc without dlsym.
> Of course, when you want to override posix_memalign (and all of its synonyms)
> as well, you're again in the same trap.
Right. I do indeed expect the list of instrumented functions to grow and
eventually cover the above as well.
> 2. Do not override malloc&co at all, but rather use malloc hooks (see "man
> malloc_hooks").
These hooks have been deprecated as they are not thread-safe. They might
become if the hooks would be stored in thread-local storage, but that
may incur runtime overhead. In any case, that would require glibc
hacking, which I think is outside the scope of this work.
Thanks,
Stefan
--
Stefan Seefeld
CodeSourcery / Mentor Graphics
http://www.mentor.com/embedded-software/
More information about the lttng-dev
mailing list