diff -r 34e1821bde93 -r 9b8f2dc281ad hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java --- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java Mon Apr 04 11:32:04 2016 +0200 +++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java Thu Mar 24 10:49:08 2016 +0100 @@ -84,6 +84,9 @@ } private static void checkUsedIncreasesWhenLoadingClass(String ns) throws Exception { + // Need to ensure that used is up to date and that all unreachable + // classes are unloaded before doing this check. + System.gc(); long before = getUsed(ns); fooClass = compileAndLoad("Foo", "public class Foo { }"); System.gc();