From d477483373b6c49cafcd73e98511becdacc21835 Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 22 Feb 2008 23:46:27 +0000 Subject: [PATCH] stronger criteria to use RAM copy to use table copy (should use less RAM) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4502 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/kelondro/kelondroEcoTable.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)))) ?