On Wed, 27 Apr 2022 23:49:56 GMT, Leonid Mesnik <lmes...@openjdk.org> wrote:

> The test failed if GC happens somewhere between
> Class<?> c = Class.forName("TestClass", true, dummyloader);
> and
> OutputAnalyzer output = executor.execute("VM.classloader_stats");
> 
> The fix is to make hc static as Chris proposed. 
> 
> To verfiy fix I add System.gc() before 
> executor.execute("VM.classloader_stats");

test/hotspot/jtreg/serviceability/dcmd/vm/ClassLoaderStatsTest.java line 178:

> 176:     static {
> 177:         try {
> 178:             // Create a hidden class, keep reference in the case if GC 
> happens

"Create a hidden class. Keep a reference in case a GC happens."

I hadn't noticed the original comment when first suggesting making the Class 
reference static. I wonder what was meant by "non-strong class".

-------------

PR: https://git.openjdk.java.net/jdk/pull/8438

Reply via email to