RFR(XS) 8191931: NMT test for anonymous/delegating metadata space sizing

Thomas Stüfe thomas.stuefe at gmail.com
Thu Mar 15 15:13:50 UTC 2018

Hi Zhengyu,


Not sure, but would this test not break if the class loader allocates a
metablock which does not fit into a specialized chunk before reaching
_anon_and_delegating_metadata_specialize_chunk_limit - which is a
theoretically valid scenario?

See calc_chunk_size():

  if ((_space_type == Metaspace::AnonymousMetaspaceType || _space_type ==
Metaspace::ReflectionMetaspaceType) &&
      _mdtype == Metaspace::NonClassType &&
      sum_count_in_chunks_in_use(SpecializedIndex) <
_anon_and_delegating_metadata_specialize_chunk_limit &&
      word_size + Metachunk::overhead() <= SpecializedChunk) {
    return SpecializedChunk;

In other words, encountering small/medium chunks before reaching the spec
chunk limit could be, at least according to  calc_chunk_size(), a valid
albeit rare scenario.



"should use up to"  -> "should use at least"
"midium" -> "medium"

Should the comment not be:

-// _anon_and_delegating_metadata_specialize_chunk_limit small chunks
before jump to midium chunks,
+// _anon_and_delegating_metadata_specialize_chunk_limit specialized chunks
before jump to medium chunks,


Do we always jump right to medium chunks from specialized chunks?


If your intention is to test "there shall be no small/medium chunks before
we have reached the limit of specialized chunks", would it not be easier to
test just that:

if (sum_count_in_chunks_in_use(MediumIndex) > 0) {
  assert(sum_count_in_chunks_in_use(SpecializedIndex) >= limit)

instead of calculating and comparing the capacity?

Best Regards, Thomas

On Thu, Mar 15, 2018 at 3:52 PM, Zhengyu Gu <zgu at redhat.com> wrote:

> Hi,
> Please review a new gtest to ensure correct sizing for anonymous and
> reflection delegating classloade's metadata space.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8191931
> Webrev: http://cr.openjdk.java.net/~zgu/8191931/webrev.00/index.html
> Thanks,
> -Zhengyu

More information about the hotspot-runtime-dev mailing list