[Gc] [Fwd: [Mono-dev] [PATCH] Cause libgc to return some unused memory to the system]

Florian Weimer fw at deneb.enyo.de
Tue Sep 8 12:54:49 PDT 2009


* Hans Boehm:

> I think it's simpler to do what the collector should already do:
> Remap the "unmapped" pages with no permission, so that that the
> kernel can replace them with zero-filled pages, and they no longer
> need actual physical memory or disk space.  This means we can remap
> the blocks when they're needed again.  And we don't have to worry
> about the kernel mapping a new heap section or a newly loaded
> dynamic library into a hole in the middle of an old heap section.
> There are no doubt other design options, but I'm not sure they
> really improve matters.

Note that it's currently unspecified (on Linux) if mprotect(PROT_NONE)
memory counts against the system commit limit in
vm.overcommit_memory=2 mode.  This means that some workloads can break
with future kernel updates.

However, most garbage collectors need something like
mprotect(PROT_NONE) to work reasonably well in vm.overcommit_memory=2
mode because they have heap layout requirements which cannot be
fulfilled with piecewise mmap allocations.


More information about the Gc mailing list