On Thu, Dec 3, 2015 at 8:35 PM, Rogier 'DocWilco' Mulhuijzen < [email protected]> wrote:
> Maybe I'm saying something stupid, but isn't there a DALLOC on the second > line of your output? > 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. If the memory was deallocated, only dalloc would have been called (no decommit or purge). Best, Jakob On Thu, Dec 3, 2015 at 10:52 AM Jakob Buchgraber <[email protected]> > wrote: > >> Hello Jason, >> >> I am playing around with the memory management hooks introduced in >> version 4. >> So I wrote a delegate for the default chunk hooks, that additionally >> report to >> stdout what's happening [1]. >> >> The test program allocates 1GB of memory and immediately frees it. >> It then tries to allocate 4MB and 8MB. The output is as follows >> >> ALLOC: new_addr 0, size 1073741824, alignment 2097152, zero 1, commit 1, >> arena_ind 0, ret 0x7f2f52a00000 >> DALLOC: chunk 0x7f2f52a00000, size 1073741824, committed 1, arena_ind 0 >> DECOMMIT: chunk 0x7f2f52a00000, size 1073741824, offset 0, length >> 1073741824, arena_ind 0 >> PURGE: chunk 0x7f2f52a00000, size 1073741824, offset 0, length >> 1073741824, arena_ind 0 >> FREED >> ALLOC: new_addr 0, size 4194304, alignment 2097152, zero 1, commit 1, >> arena_ind 0, ret 0x7f2f52a00000 >> ALLOC: new_addr 0, size 8388608, alignment 2097152, zero 1, commit 1, >> arena_ind 0, ret 0x7f2f52e00000 >> >> Given that the 1GB has not been deallocated, but purged I would expect >> the last two ALLOCations not to have happened. Instead I would expect >> the virtual memory from the 1GB allocation before to be reused? >> >> I am running jemalloc 4.0.4 on Linux. >> >> Also, on an unrelated note, is it generally safe to trigger purging for >> arena A >> from within an allocation chunk hook of arena B, with A <> B? >> The reason why am asking this question is that I would generally want to >> run with purging disabled on all arenas, but if some threshold of >> committed >> memory is surpassed I would like to enable purging for some arenas. >> Does this sound feasible? >> >> Thanks, >> Jakob >> >> [1] https://gist.github.com/buchgr/243b0aa9a2abeda2ac39 >> >> _______________________________________________ >> jemalloc-discuss mailing list >> [email protected] >> http://www.canonware.com/mailman/listinfo/jemalloc-discuss >> > -- Mit freundlichen Grüßen / Best Regards Jakob Buchgraber
_______________________________________________ jemalloc-discuss mailing list [email protected] http://www.canonware.com/mailman/listinfo/jemalloc-discuss
