trying to fix 6843484 (os::commit_memory() failures are not handled properly on linux)

Florian Weimer fw at
Mon Aug 16 10:37:38 PDT 2010

* Omair Majid:

> Hi,
> I have been trying to fix 6843484. The bug relies on exact behaviour
> of mmap(2) on linux. I have asked for help from kernel developers and
> they have suggested that this is not a bug. Just so that I am clear,
> here is what I understood from the bug report:
> The bug happens if hotspot does
> (1) mmap(ADDR,..., MAP_NORESERVE,...) = succeeds
> followed by
> (2) mmap(ADDR, .....) = fails
> in which case the map from (1) is lost.

You should change that to mmap(PROT_NONE) followed by memprotect().
It has got the added benefit of better working with
vm.overcommit_memory=2, too. 8-)

More information about the hotspot-dev mailing list