[PATCH] Allow to use different prefixes for jemalloc-specific functions and libc functions

Mike Hommey mh+jemalloc at glandium.org
Thu Mar 1 06:44:28 PST 2012


On Wed, Feb 29, 2012 at 04:15:37PM -0800, Jason Evans wrote:
> On Feb 23, 2012, at 3:23 AM, Mike Hommey wrote:
> > From: Mike Hommey <mh at glandium.org>
> > 
> > In some cases, it can be interesting to use different prefixes for
> > the "standard" libc malloc functions and for jemalloc specific
> > functions. One such case is to use the "__wrap_" prefix on libc
> > malloc functions (for use with ld's --wrap option) and no prefix or
> > "je_" for jemalloc functions.
> > 
> > In such cases, it can also me interesting not to exclude memalign
> > and valloc, so this change also adds an option not to omit them when
> > the prefix is set.
> 
> Do you have a practical use case that makes this a compelling feature?
> I'm reluctant to hard-code the set of JEMALLOC_LIBC() functions to
> make distinct from JEMALLOC_P() functions, because it may vary by
> operating system.

The exact one that is in the patch message: on android, we use ld's
--wrap option to wrap the "standard" libc functions. It is cumbersome
to have to use --wrap for jemalloc-specific functions as well.
Arguably, we could probably use symbol aliases when linking the library
containing jemalloc.

Mike



More information about the jemalloc-discuss mailing list