RFR (XS): JDK-8058967 metaspace/shrink_grow/CompressedClassSpaceSize fails with OOM: Compressed class space

Kim Barrett kim.barrett at oracle.com
Fri May 15 20:35:47 UTC 2015

On May 15, 2015, at 3:16 PM, Joseph Provino <joseph.provino at oracle.com> wrote:
> On 5/15/2015 2:29 PM, Jon Masamitsu wrote:
>> I think the statement of the policy should be updated.
> How does this sound?  Should the comment be with the "if" statement or
> where _small_chunk_limit is declared?
>  /*
>   * The policy is to allocate up to _small_chunk_limit small chunks
>   * after which only medium chunks are allocated.  This is done to
>   * reduce fragmentation.  In some cases, this can result in a lot
>   * of small chunks being allocated to the point where it's not
>   * possible to expand.  If this happens, there may be no medium chunks
>   * available and  OOME would be thrown.  Instead of doing that,
>   * if the allocation request size fits in a small chunk, an attempt
>   * is made to allocate a small chunk.
>   */
>  if (next == NULL &&
>      word_size + Metachunk::overhead() <= small_chunk_size() &&
>      grow_chunks_by_words == medium_chunk_size()) {
>    /*
>     * There are no medium chunks available but a small chunk is big enough.
>     * See if a small chunk is available.
>     */
>    next = get_new_chunk(word_size, small_chunk_size());
>  }

After further consideration and offline discussion, I'm ok with this
approach.  There are several open CRs to improve metaspace allocation,
some of which might render this change moot.  However, as a short term
fix for an intermittently failing test, this seems ok.

So the above version looks good to me.

Coalesce Metachunks in the Metaspaces

Small Metaspace allocation requests can fail even though SmallChunks are available
This might be a duplicate of 8058967.

More information about the hotspot-gc-dev mailing list