Custom allocator on top of jemalloc

SNL snl20465 at gmail.com
Tue Jan 20 10:01:26 PST 2015


I will upgrade to dev version of jemalloc. Thanks for the quick input.

On Tue, Jan 20, 2015 at 10:31 PM, Jason Evans <jasone at canonware.com> wrote:

> On Jan 20, 2015, at 5:17 AM, SNL <snl20465 at gmail.com> wrote:
> > Here is what I am doing currently:
> >
> > 1. I am trying to carve out 10 MB memory area at the higher end of
> process address space using mmap (MAP_FIXED..).
> >
> > 2. I created a new arena using arenas.extend mallctl
> >
> > 3. I am using mallocx/dallocx with MALLOCX_ARENA(arena) as documented.
> >
> > The issue is how do I connect the arena to mmaped memory chunk ? I see
> that new arena never gets initialized and all allocations continue to
> happen from arena 0x0.
> > I thought thread.arena mallctl will connect the arena to mmapped chunk
> but it just creates a thread <-> arena mapping.
> >
> > I looked at the sources to see if there is any other mallctl to create
> this association but there does not seem to be any, what am I missing here ?
> >
> > And older sample program I found on this mailing list, uses following
> mallctl which is not supported in jemalloc 3.6.
> >
> >
> > snprintf(path, sizeof(path), "arena.%u.chunk.alloc", _arena);
> >   ret = __svm_mallctl(path, (void*)&_chunk_alloc, &sz,
> (void*)&_chunk_alloc, sizeof(void *));
> >   assert (ret == 0);
> >
> > snprintf(path, sizeof(path), "arena.%u.chunk.dalloc", _arena);
> >   ret = __svm_mallctl(path, (void*)&_chunk_dalloc, &sz,
> (void*)&_chunk_dalloc, sizeof(void *));
> >   assert (ret == 0);
> >
> >
> > This basically is asking jemalloc to callback user defined functions, is
> this functionality still available in jemalloc ? Any inputs will be
> helpful. Thanks.
>
> The features you're trying to use only exist in the dev version of
> jemalloc so far ("arena.<i>.chunk.alloc" and "arena.<i>.chunk.dalloc"
> mallctl interfaces).  Note that related control over dirty page purging
> still needs to be implemented (
> https://github.com/jemalloc/jemalloc/issues/93).
>
> Jason




-- 

Cheers,
Sunny.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20150120/ed4207fb/attachment.html>


More information about the jemalloc-discuss mailing list