--- old/src/share/vm/memory/metaspace.cpp 2015-05-12 14:52:30.965341693 -0400 +++ new/src/share/vm/memory/metaspace.cpp 2015-05-12 14:52:30.837334358 -0400 @@ -615,8 +615,7 @@ Metachunk* _chunks_in_use[NumberOfInUseLists]; Metachunk* _current_chunk; - // Number of small chunks to allocate to a manager - // If class space manager, small chunks are unlimited + // Maximum number of small chunks to allocate to a SpaceManager static uint const _small_chunk_limit; // Sum of all space in allocated chunks @@ -2088,6 +2087,16 @@ MetaWord* mem = NULL; + 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()); + } + // If a chunk was available, add it to the in-use chunk list // and do an allocation from it. if (next != NULL) {