<div dir="ltr"><div style="font-size:13px"><span style="font-size:small">On Thu, Dec 3, 2015 at 8:35 PM, Rogier 'DocWilco' Mulhuijzen </span><span dir="ltr"><<a href="mailto:rogier+jemalloc@fastly.com" target="_blank">rogier+jemalloc@fastly.com</a>></span><span style="font-size:small"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Maybe I'm saying something stupid, but isn't there a DALLOC on the second line of your output?</div></blockquote><div><br></div><div style="font-size:13px">That output just states that dalloc was called. However, the dalloc chunk hook opts out of deallocation. So next jemalloc calls decommit, again with decommit opting out of decommitting the memory and so finally purge gets called, which one can't opt out from. </div><div style="font-size:13px"><br></div><div style="font-size:13px">If the memory was deallocated, only dalloc would have been called (no decommit or purge).</div><div style="font-size:13px"><br></div><div style="font-size:13px">Best,</div><div><span style="font-size:13px">Jakob</span> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Thu, Dec 3, 2015 at 10:52 AM Jakob Buchgraber <<a href="mailto:jakob.buchgraber@tum.de" target="_blank">jakob.buchgraber@tum.de</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hello Jason,</div><div><br></div><div>I am playing around with the memory management hooks introduced in version 4.</div><div>So I wrote a delegate for the default chunk hooks, that additionally report to</div><div>stdout what's happening [1]. </div><div><br></div><div>The test program allocates 1GB of memory and immediately frees it.</div><div>It then tries to allocate 4MB and 8MB. The output is as follows</div><div><br></div><div><div>ALLOC: new_addr 0, size 1073741824, alignment 2097152, zero 1, commit 1, arena_ind 0, ret 0x7f2f52a00000</div><div>DALLOC: chunk 0x7f2f52a00000, size 1073741824, committed 1, arena_ind 0</div><div>DECOMMIT: chunk 0x7f2f52a00000, size 1073741824, offset 0, length 1073741824, arena_ind 0</div><div>PURGE: chunk 0x7f2f52a00000, size 1073741824, offset 0, length 1073741824, arena_ind 0</div><div>FREED</div><div>ALLOC: new_addr 0, size 4194304, alignment 2097152, zero 1, commit 1, arena_ind 0, ret 0x7f2f52a00000</div><div>ALLOC: new_addr 0, size 8388608, alignment 2097152, zero 1, commit 1, arena_ind 0, ret 0x7f2f52e00000</div></div><div><br></div><div>Given that the 1GB has not been deallocated, but purged I would expect </div><div>the last two ALLOCations not to have happened. Instead I would expect</div><div>the virtual memory from the 1GB allocation before to be reused?</div><div><br></div><div>I am running jemalloc 4.0.4 on Linux.</div><div><br></div><div>Also, on an unrelated note, is it generally safe to trigger purging for arena A</div><div>from within an allocation chunk hook of arena B, with A <> B? </div><div>The reason why am asking this question is that I would generally want to </div><div>run with purging disabled on all arenas, but if some threshold of committed </div><div>memory is surpassed I would like to enable purging for some arenas. </div><div>Does this sound feasible?</div><div><br></div><div>Thanks,</div><div>Jakob</div><div><br></div>[1] <a href="https://gist.github.com/buchgr/243b0aa9a2abeda2ac39" target="_blank">https://gist.github.com/buchgr/243b0aa9a2abeda2ac39</a>
<div><br></div></div></div></div>
_______________________________________________<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>
</blockquote></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div><br></div>Mit freundlichen Grüßen / Best Regards<div>Jakob Buchgraber</div></div>
</div></div>