More aggressive page purging

Mike Hommey mh+jemalloc at
Thu May 10 03:00:18 PDT 2012

On Thu, May 10, 2012 at 11:51:24AM +0200, Mike Hommey wrote:
> Hi,
> madvise(MADV_FREE), on OSX, is not quite like madvise(MADV_DONTNEED) on
> Linux: it doesn't actually do anything until the kernel really needs to
> because of some memory pressure (or at least it looks like so). This
> means that even when triggering an arenas.purge with mallctl, we can't
> rely on the RSS value we get.
> One way to make pages purging more aggressive is to use mmap(MAP_FIXED)
> instead of madvise. As far as I can tell, it doesn't have an effect on
> performance, at least not on Firefox.
> Do you think we could reasonably switch pages_purge to use
> mmap(MAP_FIXED) on OSX, or would you prefer a configure option?

In fact, it seems I talked too soon. it seems there *is* a performance
impact. However, I think having mallctl("arenas.purge") trigger
mmap(MAP_FIXED) instead of madvise() on OSX would be helpful, and
wouldn't hurt.


More information about the jemalloc-discuss mailing list