jemalloc hooks clarifications

Rogier 'DocWilco' Mulhuijzen rogier+jemalloc at fastly.com
Thu Dec 3 11:35:24 PST 2015


Maybe I'm saying something stupid, but isn't there a DALLOC on the second
line of your output?

On Thu, Dec 3, 2015 at 10:52 AM Jakob Buchgraber <jakob.buchgraber at tum.de>
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
> jemalloc-discuss at canonware.com
> http://www.canonware.com/mailman/listinfo/jemalloc-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20151203/b5fab8e2/attachment.html>


More information about the jemalloc-discuss mailing list