<div dir="ltr">Hi,<div><br></div><div>I have a follow up question.</div><div><br></div><div>We have only 40 MB of memory for our sub system.</div><div><br></div><div>I start up Jemalloc is keep asking for new chunks and by the time the system becomes ready it almost consumes 38 MB of memory.</div><div><br></div><div>How we can tell Jemalloc to uses already allocated memory chuck when we run out of our 40 MB of memory?</div><div><br></div><div>Thanks</div><div>Rajakishore</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 13, 2015 at 8:21 AM, RajaKishore Sahu <span dir="ltr"><<a href="mailto:raju.sahu@gmail.com" target="_blank">raju.sahu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Luke,<br><div><br></div><div>Thanks for sharing the details. I will go through the code and come back if I need some more help.</div><div><br></div><div>Thanks</div><div><span style="color:rgb(80,0,80);font-size:12.8000001907349px">Rajakishore Sahu</span><br></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Mon, Oct 12, 2015 at 5:09 PM, D'Alessandro, Luke K <span dir="ltr"><<a href="mailto:ldalessa@indiana.edu" target="_blank">ldalessa@indiana.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On Oct 12, 2015, at 1:12 AM, RajaKishore Sahu <<a href="mailto:raju.sahu@gmail.com" target="_blank">raju.sahu@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I am trying to port Jemalloc. We are going to use it for our sub-system not for the whole system.<br>
><br>
> 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?<br>
<br>
</span>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()).<br>
<br>
To do what you want you need to write a chunk provider based on [the chunk hooks class](<a href="http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html" rel="noreferrer" target="_blank">http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html</a>), 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.<br>
<br>
We do this in HPX-5 to manage a network-registered global heap. The callback chunks are [here](<a href="https://gitlab.crest.iu.edu/extreme/hpx/blob/develop/libhpx/gas/pgas/jemalloc_global.c" rel="noreferrer" target="_blank">https://gitlab.crest.iu.edu/extreme/hpx/blob/develop/libhpx/gas/pgas/jemalloc_global.c</a>) and the “heap” is implemented (here)[<a href="https://gitlab.crest.iu.edu/extreme/hpx/blob/develop/libhpx/gas/pgas/heap.c" rel="noreferrer" target="_blank">https://gitlab.crest.iu.edu/extreme/hpx/blob/develop/libhpx/gas/pgas/heap.c</a>]. 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.<br>
<span><br>
> 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?<br>
<br>
</span>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.<br>
<br>
Luke<br>
<span><br>
><br>
> Any help will greatly appreciated!<br>
><br>
><br>
> --<br>
> Thanx<br>
> Rajakishore Sahu<br>
> <a href="mailto:Mail%3A-raju.sahu@gmail.com" target="_blank">Mail:-raju.sahu@gmail.com</a><br>
</span>> _______________________________________________<br>
> jemalloc-discuss mailing list<br>
> <a href="mailto:jemalloc-discuss@canonware.com" target="_blank">jemalloc-discuss@canonware.com</a><br>
> <a href="http://www.canonware.com/mailman/listinfo/jemalloc-discuss" rel="noreferrer" target="_blank">http://www.canonware.com/mailman/listinfo/jemalloc-discuss</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br></div></div><div><div><div class="h5">Thanx<br>Rajakishore Sahu<br><a href="mailto:Mail%3A-raju.sahu@gmail.com" target="_blank">Mail:-raju.sahu@gmail.com</a><br></div></div>Mobile:-+91 9886719841</div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Thanx<br>Rajakishore Sahu<br><a href="mailto:Mail%3A-raju.sahu@gmail.com" target="_blank">Mail:-raju.sahu@gmail.com</a><br>Mobile:-+91 9886719841</div>
</div>