diff --git a/source/net/yacy/kelondro/blob/HeapReader.java b/source/net/yacy/kelondro/blob/HeapReader.java index af7f01892..037b58c5d 100644 --- a/source/net/yacy/kelondro/blob/HeapReader.java +++ b/source/net/yacy/kelondro/blob/HeapReader.java @@ -645,7 +645,7 @@ public class HeapReader { if (this.index != null) this.index.close(); this.index = null; this.closeDate = new Date(); - Log.logInfo("HeapReader", "close HeapFile " + this.heapFile.getName() + "; trace:" + Log.stackTrace()); + Log.logInfo("HeapReader", "close HeapFile " + this.heapFile.getName() + "; trace: " + Log.stackTrace()); } } diff --git a/source/net/yacy/kelondro/util/MemoryControl.java b/source/net/yacy/kelondro/util/MemoryControl.java index 55f2e4a8c..0866f76ac 100644 --- a/source/net/yacy/kelondro/util/MemoryControl.java +++ b/source/net/yacy/kelondro/util/MemoryControl.java @@ -32,7 +32,7 @@ public class MemoryControl { private static boolean shortStatus = false, simulatedShortStatus = false, usingStandardStrategy = true; private static MemoryStrategy strategy; - + private static MemoryStrategy getStrategy() { if (strategy == null || strategy.hasError()) { if (!usingStandardStrategy) { @@ -48,14 +48,16 @@ public class MemoryControl { } return strategy; } - + public final static void setStandardStrategy(final boolean std) { + /* if (usingStandardStrategy != std) { usingStandardStrategy = std; strategy = null; } + */ } - + /** * @return the name of the used strategy */ @@ -108,12 +110,13 @@ public class MemoryControl { /** * check for a specified amount of bytes - * + * * @param size the requested amount of free memory in bytes * @param force specifies whether risk an expensive GC * @return whether enough memory could be freed (or is free) or not */ public static boolean request(final long size, final boolean force) { + if (size < 1024) return true; // to speed up things. If this would fail, it would be much too late to check this. return getStrategy().request(size, force, shortStatus); } @@ -187,7 +190,7 @@ public class MemoryControl { System.out.println("computed max = " + (maxMemory() / mb) + " mb"); System.out.println("using " + getStrategyName()); final byte[][] x = new byte[100000][]; - + for (int i = 0; i < 100000; i++) { if (request(mb, force)) {