Question about VirtualSpace and MPSS support

Thomas Stüfe thomas.stuefe at
Mon Nov 21 15:24:54 UTC 2016

On Mon, Nov 21, 2016 at 8:36 AM, Erik Helin <erik.helin at> wrote:

> On 11/17/2016 12:27 PM, Thomas Stüfe wrote:
>> I wonder why VirtualSpace keeps the unaligned high water mark around
>> instead of, say, just rounding _high up to the next page boundary. A
>> simpler approach would have been to advance _high to the next page
>> boundary and just forget the exact increments the caller requested.
>> Then, caller needs to deal with the fact that an VirtualSpace may expand
>> by more than the requested size, and for future size calculations always
>> needs to refer to VirtualSpace::high(). This could be a cleanup for jdk10.
> Well, you would have to make sure that all code that uses
> VirtualSpace::expand_by today can deal with this change in semantics. The
> benefit of the change also hinges on how much of the code that uses
> VirtualSpace today needs to keep track of how much a VirtualSpace have
> expanded (without aligning to page size). If a lot of code need this
> functionality, then you will just be moving it out of VirtualSpace and into
> a number of places spread throughout the code. OTOH, if very little code
> requires this knowledge, then the change might be worth it.
You are right, if this change forces the callers to keep track of the
unaligned high water mark themselves, nothing is gained.

> One could also consider writing a wrapper around VirtualSpace that keeps
> track of exactly this information.

Good idea.

> Thanks,
> Erik
In the meantime I did find another way to handle the humongous metaspace
chunks, so my original idea of allocating from the top of the VirtualSpace
may not be needed. Thank you for looking into this!


Thanks, Thomas

More information about the hotspot-runtime-dev mailing list