From 249a78ff2a647f9dee14da68916836d309232e11 Mon Sep 17 00:00:00 2001 From: sixcooler Date: Mon, 14 Nov 2011 11:54:03 +0100 Subject: [PATCH] G1 Memory Strategy - not used now --- source/net/yacy/kelondro/util/MemoryControl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/kelondro/util/MemoryControl.java b/source/net/yacy/kelondro/util/MemoryControl.java index 55f2e4a8c..d1b46a8ba 100644 --- a/source/net/yacy/kelondro/util/MemoryControl.java +++ b/source/net/yacy/kelondro/util/MemoryControl.java @@ -37,6 +37,9 @@ public class MemoryControl { if (strategy == null || strategy.hasError()) { if (!usingStandardStrategy) { strategy = new GenerationMemoryStrategy(); +// if (strategy.hasError()) { // perhaps we do have a G1 +// strategy = new G1MemoryStrategy(); +// } // fall back if error detected if (strategy.hasError()) { usingStandardStrategy = true; @@ -187,17 +190,20 @@ public class MemoryControl { System.out.println("computed max = " + (maxMemory() / mb) + " mb"); System.out.println("using " + getStrategyName()); final byte[][] x = new byte[100000][]; - + byte[] y; for (int i = 0; i < 100000; i++) { + if (i== 10) System.gc(); if (request(mb, force)) { - x[i] = new byte[mb]; + y = new byte[mb]; + x[i] = y; System.out.println("used = " + i + " / " + (used() /mb) + ", total = " + (total() / mb) + ", free = " + (free() / mb) + ", max = " + (maxMemory() / mb) + ", avail = " + (available() / mb) + - (usingStandardStrategy? ", averageGC = " + ((StandardMemoryStrategy)getStrategy()).getAverageGCFree() : "")); + (usingStandardStrategy? ", averageGC = " + ((StandardMemoryStrategy)getStrategy()).getAverageGCFree() : + ", proper = " + properState())); } else System.exit(0); }