Allow je_malloc_message to be overridden when linking statically

Mike Hommey mh+jemalloc at glandium.org
Wed May 2 04:17:20 PDT 2012


On Wed, May 02, 2012 at 01:15:00PM +0200, Mike Hommey wrote:
> From: Mike Hommey <mh at glandium.org>
> 
> If an application wants to override je_malloc_message, it is better to define
> the symbol locally than to change its value in main(), which might be too late
> for various reasons.
> 
> Due to je_malloc_message being initialized in util.c, statically linking
> jemalloc with an application defining je_malloc_message fails due to
> "multiple definition of" the symbol.
> 
> Defining it without a value (like je_malloc_conf) makes it more easily
> overridable.

Also, I wonder what is the added value of having the cbopaque value
passed down to je_malloc_message. It would seem better to drop that
argument, and use a wrapper to call it.

Mike



More information about the jemalloc-discuss mailing list