JDK-8035945 : Small Metaspace allocation requests can fail even though SmallChunks are available
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2014-02-27
  • Updated: 2023-08-21
  • Resolved: 2015-06-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
The current Metaspace chunk allocation policy allocates into four SmallChunks before starting to allocate into MediumChunks. When the metaspace for a ClassLoader has once started to allocate into MediumChunks it will continue to allocate into MediumChunks and never consider the SmallChunks, even though the alloc requests might only need a SmallChunk.

This might lead to unnecessary GCs and OOMEs.
Comments
This is a duplicate of https://bugs.openjdk.java.net/browse/JDK-8081508
04-06-2015

This is a duplicate of https://bugs.openjdk.java.net/browse/JDK-8081508.
04-06-2015

I = Can trigger premature GCs and potential out of metaspace memory errors -> High L = Not very common for normal applications -> Low W = Use a larger metaspace size -> Low HLL = P4
27-02-2014

This was found while investigating JDK-8034852. See that bug for the test used. After getting repeated GCs (The bug in JDK-8034852) I found that we tried to allocate Metadata of 344 words. The Free Chunk List has no MediumChunks and a lot of SmallChunks, but we still fail to allocate. (gdb) p *this->_loader_data->_metaspace->_chunk_manager_metadata $23 = { <CHeapObj<1792u>> = {<No data fields>}, members of ChunkManager: _free_chunks = {{ // Specialized Chunks _head = 0x7f6788faac00, _tail = 0x7f67834fe400, _size = 128, _count = 106 }, { // Small Chunks _head = 0x7f6783d7d000, _tail = 0x7f67a4b91400, _size = 512, _count = 3679 }, { // Medium Chunks _head = 0x0, _tail = 0x0, _size = 8192, _count = 0 }},
27-02-2014