RFR(S) 8015255: NPG: Don't waste fragment at the end of a VirtualSpaceNode before retiring it.

Mikael Gerdin mikael.gerdin at oracle.com
Thu Oct 17 12:56:00 UTC 2013


Hi all,

Please review this change to fix needless memory waste in Metaspace.

Description of problem:
When receiving an allocation request which cannot be satisfied with the 
current VirtualSpaceNode the remaining committed memory in the current node is 
wasted when a new node is created and the allocation is satisfied from the new 
node.

Suggested fix:
Before creating a new VirtualSpaceNode, "retire" the current node by 
allocating chunks of decreasing size from the committed memory present in the 
current node.
To ensure that allocating chunks at the end of a node uses all committed 
memory I've increased the size alignment for humongous chunks to the smallest 
chunk size. I don't foresee this increasing memory waste since previously the 
memory difference between 2-word-aligned sizes and smallest chunk-aligned 
would go unused since no chunk would fit there.

Testing:
Added new unit tests for VirtualSpaceNode and the retire functionality.
JPRT run (including the new unit tests)

Webrev: http://cr.openjdk.java.net/~mgerdin/8015255/webrev.0/
Buglink: https://bugs.openjdk.java.net/browse/JDK-8015255

/Mikael



More information about the hotspot-gc-dev mailing list