--- old/test/gc/metaspace/TestMetaspacePerfCounters.java 2016-03-23 10:01:26.974316838 +0100 +++ new/test/gc/metaspace/TestMetaspacePerfCounters.java 2016-03-23 10:01:26.866312594 +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();