On Jun 4, 2016, at 3:22 PM, Bill O'Hara <[email protected]> wrote:
> I see various hints that it's possible to use jemalloc to manage a given 
> memory space. That is, given a pointer to say 16GB of byte addressable 
> memory, use jemalloc to manage it as a heap.
> 
> 1) Can someone point me in the direction of a simple example, or hints on how 
> to configure jemalloc to do this?

Here's the relevant documentation:

        
http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#arena.i.chunk_hooks

Here's a test case that gives a basic example of how to use the chunk hooks API:

        
https://github.com/jemalloc/jemalloc/blob/master/test/integration/chunk.c

> 2) Further -- is it possible to get jemalloc to put it's own data structures 
> entirely within the given 16GB space, so that if the process restarts that 
> the heap can be reattached?

No, there are lots of places where jemalloc uses static data, and it's 
generally important to performance to do so.  As of 4.2.0, application-created 
arenas (see 
http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#arenas.extend)
 put all their metadata in one of the automatically multiplexed arenas so that 
it's possible to discard the contents of an arena with a single call 
(http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#arena.i.reset),
 which is sort of the opposite of what you want.

Jason
_______________________________________________
jemalloc-discuss mailing list
[email protected]
http://www.canonware.com/mailman/listinfo/jemalloc-discuss

Reply via email to