fix for false RAM table activation in EcoTables

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4441 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent df548f444f
commit 249d61759a

@ -97,13 +97,13 @@ public class kelondroEcoTable implements kelondroIndex {
// initialize index and copy table // initialize index and copy table
int records = (int) Math.max(file.size(), initialSpace); int records = (int) Math.max(file.size(), initialSpace);
long neededRAM4table = 200 * 1024 * 1024 + records * (rowdef.objectsize + 4) * 3 / 2; long neededRAM4table = records * (rowdef.objectsize + 4) * 3 / 2;
table = ((neededRAM4table < maxarraylength) && table = ((neededRAM4table < maxarraylength) &&
((useTailCache == tailCacheForceUsage) || ((useTailCache == tailCacheForceUsage) ||
((useTailCache == tailCacheUsageAuto) && (serverMemory.request(neededRAM4table, false))))) ? ((useTailCache == tailCacheUsageAuto) && (serverMemory.request(neededRAM4table + 200 * 1024 * 1024, false))))) ?
new kelondroRowSet(taildef, records) : null; new kelondroRowSet(taildef, records) : null;
System.out.println("*** DEBUG " + tablefile + ": available RAM: " + (serverMemory.available() / 1024 / 1024) + "MB, allocating space for " + records + " entries"); System.out.println("*** DEBUG " + tablefile + ": available RAM: " + (serverMemory.available() / 1024 / 1024) + "MB, allocating space for " + records + " entries");
long neededRAM4index = 200 * 1024 * 1024 + records * (rowdef.primaryKeyLength + 4) * 3 / 2; long neededRAM4index = 2 * 1024 * 1024 + records * (rowdef.primaryKeyLength + 4) * 3 / 2;
if (!serverMemory.request(neededRAM4index, false)) { if (!serverMemory.request(neededRAM4index, false)) {
// despite calculations seemed to show that there is enough memory for the table AND the index // despite calculations seemed to show that there is enough memory for the table AND the index
// there is now not enough memory left for the index. So delete the table again to free the memory // there is now not enough memory left for the index. So delete the table again to free the memory

Loading…
Cancel
Save