Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

stronger criteria to use RAM copy to use table copy (should use less RAM)

orbiterd477483373b6
diff --git a/source/de/anomic/kelondro/kelondroEcoTable.java b/source/de/anomic/kelondro/kelondroEcoTable.java
index 8d4eeb9eb..dd42b4718 100644
--- a/source/de/anomic/kelondro/kelondroEcoTable.java
+++ b/source/de/anomic/kelondro/kelondroEcoTable.java
@@ -59,7 +59,7 @@ public class kelondroEcoTable implements kelondroIndex {
public static final int tailCacheForceUsage = 1;
public static final int tailCacheUsageAuto = 2;
- public static final long maxarraylength = 134217727; // that may be the maxmimum size of array length in some JVMs
+ public static final long maxarraylength = 134217727L; // that may be the maxmimum size of array length in some JVMs
private kelondroRowSet table;
private kelondroBytesIntMap index;
@@ -97,7 +97,7 @@ public class kelondroEcoTable implements kelondroIndex {
// initialize index and copy table
int records = (int) Math.max(file.size(), initialSpace);
- long neededRAM4table = records * (rowdef.objectsize + 4) * 3 / 2;
+ long neededRAM4table = ((long) records) * (((long) rowdef.objectsize) + 4L) * 3L;
table = ((neededRAM4table < maxarraylength) &&
((useTailCache == tailCacheForceUsage) ||
((useTailCache == tailCacheUsageAuto) && (Runtime.getRuntime().freeMemory() > neededRAM4table + 200 * 1024 * 1024)))) ?