Is it safe to mix jemalloc with glibc malloc?

Jokea tfengjun at
Tue Feb 28 17:31:35 PST 2012


I'm trying to use jemalloc with FusionIO, where all objects allocated by
jemalloc are from FusionIO, because the application needs a really huge
amount of them, and the actual ram size does not fit.

I'm just assuming that je_malloc from mmap-ed FusionIO will be slower
than malloc from real ram, and free them are slower too.


Justin Lebar 写道:
>> 1. compile jemalloc with "je_" prefix and with "--enable-swap",
>> 2. in my application:
>> ...
>> void *big = je_malloc(10000);
>> void *small = malloc(10);
>> ...
>> je_free(big);
>> free(small);
> Yes, this is safe.
>> There are plenty of small objects which will be freed soon, so I want to use
>> the real
>> memory for these temp objects to improve performance.
> But I seriously doubt you're going to see a performance improvement by
> doing this.  IME, jemalloc is much faster than glibc malloc, for all
> allocation sizes.
> -Justin

More information about the jemalloc-discuss mailing list