> On Oct 12, 2015, at 1:12 AM, RajaKishore Sahu <[email protected]> wrote:
> 
> Hi,
> 
> I am trying to port Jemalloc. We are going to use it for our sub-system not 
> for the whole system.
> 
> Main system has its own memory manager. While initializing the sub-system (in 
> boot up) we will allocate memory from main system (Ex:- 10 MB) which will be 
> contiguous memory then we want to give the start address and size to Jemalloc 
> to manage it. Please let us know where to provide the start address to 
> jemalloc?

Hi. This dlmalloc-mspace-like interface isn’t really supported by jemalloc, 
which wants to be able to request “chunks” of memory from the system using a 
chunk allocator (typically mmap()). 

To do what you want you need to write a chunk provider based on [the chunk 
hooks 
class](http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html),
 and then install it for all of the threads in your code. Your chunk provider 
will have to give jemalloc chunks from your contiguous region.

We do this in HPX-5 to manage a network-registered global heap. The callback 
chunks are 
[here](https://gitlab.crest.iu.edu/extreme/hpx/blob/develop/libhpx/gas/pgas/jemalloc_global.c)
 and the “heap” is implemented 
(here)[https://gitlab.crest.iu.edu/extreme/hpx/blob/develop/libhpx/gas/pgas/heap.c].
 This code is slightly complex but it’s basically just using a bitmap to 
allocate chunks from a large contiguous heap, and can serve as an example for 
you.

> Main system will provide thread, Mutex/Semaphore and the memory for this will 
> not be allocated from the sub-system. In this scenario how can we enable 
> thread caching? We do have a rapper to create threads, which means we know 
> which are the the threads created by sub-system. Will it help in enabling the 
> thread caching?

Thread caching will likely be on by default for the threads. In more complex 
code where you might want to manage more than one memory space, you may need to 
explicitly allocate new caches.

Luke

> 
> Any help will greatly appreciated!
> 
> 
> -- 
> Thanx
> Rajakishore Sahu
> Mail:[email protected]
> _______________________________________________
> jemalloc-discuss mailing list
> [email protected]
> http://www.canonware.com/mailman/listinfo/jemalloc-discuss

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

Reply via email to