|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|