Example of using jemalloc to manage a given memory space?
billtohara at gmail.com
Sun Jun 12 14:22:11 PDT 2016
On Wed, Jun 8, 2016 at 5:26 PM, Jason Evans <jasone at canonware.com> wrote:
> On Jun 4, 2016, at 3:22 PM, Bill O'Hara <billtohara at gmail.com> 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:
> Here's a test case that gives a basic example of how to use the chunk
> hooks API:
Thank you Jason, after some fiddling, I got my existing code rebased on top
of a jemalloc managed arena. Perf looks great.
Thanks also for the clear answer on the second part.
> > 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
> 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 (
> which is sort of the opposite of what you want.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the jemalloc-discuss