RFR(xxs): 8202424: Metaspace: on chunk retirement, use correct lower limit on chunksize when adding blocks to free blocks list.

Thomas Stüfe thomas.stuefe at gmail.com
Mon Apr 30 14:07:39 UTC 2018

Hi all,

please review this small fix, which fixes a small metaspace leak when
retiring chunks.

Bug: https://bugs.openjdk.java.net/browse/JDK-8202424
Webrev: http://cr.openjdk.java.net/~stuefe/webrevs/8202424-Metaspace-on-chunk-retirement-use-correct-lower-limit-on-chunksize-when-adding-blocks-to-free-blocks-list/webrev.00/webrev/

Some time ago, JDK-8164921 got rid of dark matter by lowering the
smallest block size which can be managed by the free block list to

When retiring chunks, the leftover space in the old chunk is added to
the free block list via SpaceManager::deallocate(). Here, we still
unnecessarily assume a lower size limit of TreeChunk<Metablock,
FreeList<Metablock> >::min_size(), which is unnecessary high and
causes leaks which show up as waste in the retired chunks.

By correctly using SmallBlocks::small_block_min_size() when
deallocating the leftover chunk space on chunk retirement, we can
reduce that kind of waste to almost nil.

Thanks, Thomas

More information about the hotspot-runtime-dev mailing list