Review request (hs24): 8007074: SIGSEGV at ParMarkBitMap::verify_clear()
Florian Weimer
fweimer at redhat.com
Tue Jul 9 04:06:14 PDT 2013
On 07/02/2013 06:57 PM, Stefan Karlsson wrote:
> When the JVM starts it reserves a memory area for the entire Java heap.
> We use mmap(...MAP_NORESERVE...) to reserve a contiguous chunk of memory
> that no other
> subsystem of the JVM, or Java program, will be allowed to mmap into.
>
> The reservation of the memory only reflects the maximum possible heap
> size, but often a smaller heap size is used if the memory pressure is
> low. The part of
> the heap that is actually used is committed with mmap(...MAP_FIXED...).
Since you mention this, here's a really old pet peeve of mine.
This does not work as intended. mmap(...MAP_NORESERVE...) actually
commits the memory. The correct way to reserve address space on Linux
is to drop MAP_NORESERVE and map the memory with PROT_NONE.
Subsequently, you can commit the memory using mprotect() and suitable
protection flags. This way, the default heap size will no longer cause
failures with vm.overcommit_memory=2.
Would you be interested in a patch that improves matters in this area?
(Note that this only applies to Linux, not necessarily other systems.)
--
Florian Weimer / Red Hat Product Security Team
More information about the hotspot-dev
mailing list