< prev index next >

test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java

Print this page




  77         for (int i = 0; i < 100; i++) {
  78             // A large object that will be reclaimed eagerly.
  79             large = new int[6*M];
  80             fromOld.ref = large;
  81             genGarbage();
  82         }
  83 
  84         // Keep the reference to the first object alive.
  85         System.out.println(ref_from_stack);
  86     }
  87 }
  88 
  89 public class TestEagerReclaimHumongousRegionsWithRefs {
  90 
  91     public static void main(String[] args) throws Exception {
  92         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  93             "-XX:+UseG1GC",
  94             "-Xms128M",
  95             "-Xmx128M",
  96             "-Xmn16M",
  97             "-XX:+PrintGC",
  98             ReclaimRegionFast.class.getName());
  99 
 100         Pattern p = Pattern.compile("Full GC");
 101 
 102         OutputAnalyzer output = new OutputAnalyzer(pb.start());
 103 
 104         int found = 0;
 105         Matcher m = p.matcher(output.getStdout());
 106         while (m.find()) {
 107             found++;
 108         }
 109         System.out.println("Issued " + found + " Full GCs");
 110 
 111         assertLessThan(found, 10, "Found that " + found + " Full GCs were issued. This is larger than the bound. Eager reclaim of objects once referenced from old gen seems to not work at all");
 112         output.shouldHaveExitValue(0);
 113     }
 114 }
 115 


  77         for (int i = 0; i < 100; i++) {
  78             // A large object that will be reclaimed eagerly.
  79             large = new int[6*M];
  80             fromOld.ref = large;
  81             genGarbage();
  82         }
  83 
  84         // Keep the reference to the first object alive.
  85         System.out.println(ref_from_stack);
  86     }
  87 }
  88 
  89 public class TestEagerReclaimHumongousRegionsWithRefs {
  90 
  91     public static void main(String[] args) throws Exception {
  92         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  93             "-XX:+UseG1GC",
  94             "-Xms128M",
  95             "-Xmx128M",
  96             "-Xmn16M",
  97             "-Xlog:gc",
  98             ReclaimRegionFast.class.getName());
  99 
 100         Pattern p = Pattern.compile("Full GC");
 101 
 102         OutputAnalyzer output = new OutputAnalyzer(pb.start());
 103 
 104         int found = 0;
 105         Matcher m = p.matcher(output.getStdout());
 106         while (m.find()) {
 107             found++;
 108         }
 109         System.out.println("Issued " + found + " Full GCs");
 110 
 111         assertLessThan(found, 10, "Found that " + found + " Full GCs were issued. This is larger than the bound. Eager reclaim of objects once referenced from old gen seems to not work at all");
 112         output.shouldHaveExitValue(0);
 113     }
 114 }
 115 
< prev index next >