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
This commit is contained in:
orbiter 2008-02-22 23:46:27 +00:00
parent a7abee3578
commit d477483373

View File

@ -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)))) ?