Request for review: JDK-8009561 NPG: Metaspace fragmentation when retiring a Metachunk
mikael.gerdin at oracle.com
Wed Aug 14 12:59:27 UTC 2013
After some discussions and some benchmarking I have a new version of the
The idea is to use FreeBlockDictionary<Metablock>::atLeast but limiting
the splitting of large blocks by refusing the allocation if the block
returned from the freelist is 4x larger than the allocation request.
I also reduced the freelist allocation threshold since 64k seems too
large for what is in effect a per-ClassLoaderData freelist.
On 2013-06-05 16:04, Mikael Gerdin wrote:
> Can I have some reviews of this small fix to the Metaspace memory
> allocation path.
> When a Metaspace allocation request cannot be satisfied by the current
> chunk the chunk is retired and a new chunk is requested. This causes
> whatever is left in the chunk to be effectively leaked.
> Suggested fix:
> Put the remaining memory in each chunk on the Metablock freelist so it
> can be used to satisfy future allocations.
> Possible addition:
> When allocating from the block free list, use
> FreeBlockDictionary<Metablock>::atLeast instead of
> FreeBlockDictionary<Metablock>::exactly and split the Metablock if it's
> large enough.
> One might argue that this increases the fragmentation of the memory on
> the block free list but I think that we primarily want to use the block
> free list for small allocations and allocate from chunks for large
> Only fix:
> Incremental webrev for splitting blocks:
> Bug links:
More information about the hotspot-gc-dev