< prev index next >

test/runtime/Metaspace/FragmentMetaspace.java

Print this page

        

*** 23,33 **** /** * @test * @library /runtime/testlibrary * @build GeneratedClassLoader ! * @run main/othervm/timeout=200 FragmentMetaspace */ import java.io.IOException; /** --- 23,33 ---- /** * @test * @library /runtime/testlibrary * @build GeneratedClassLoader ! * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace */ import java.io.IOException; /**
*** 36,59 **** * iteration. By increasing the size of the class meta data needed for every iteration * we stress the subsystem for allocating native memory for meta data. */ public class FragmentMetaspace { public static void main(String... args) { ! runGrowing(Long.valueOf(System.getProperty("time", "80000"))); // try to clean up and unload classes to decrease // class verification time in debug vm System.gc(); } ! private static void runGrowing(long time) { long startTime = System.currentTimeMillis(); ! for (int i = 0; System.currentTimeMillis() < startTime + time; ++i) { try { GeneratedClassLoader gcl = new GeneratedClassLoader(); ! Class<?> c = gcl.getGeneratedClasses(i, 100)[0]; c.newInstance(); c = null; gcl = null; } catch (IOException|InstantiationException|IllegalAccessException ex) { --- 36,62 ---- * iteration. By increasing the size of the class meta data needed for every iteration * we stress the subsystem for allocating native memory for meta data. */ public class FragmentMetaspace { + public static Class<?> c; + public static void main(String... args) { ! runGrowing(Long.valueOf(System.getProperty("time", "80000")), ! Integer.valueOf(System.getProperty("iterations","200"))); // try to clean up and unload classes to decrease // class verification time in debug vm System.gc(); } ! private static void runGrowing(long time,int iterations) { long startTime = System.currentTimeMillis(); ! for (int i = 0; System.currentTimeMillis() < startTime + time && i<iterations; ++i) { try { GeneratedClassLoader gcl = new GeneratedClassLoader(); ! c = gcl.getGeneratedClasses(i, 100)[0]; c.newInstance(); c = null; gcl = null; } catch (IOException|InstantiationException|IllegalAccessException ex) {
< prev index next >