From 634430c48a9d8e138424344ed47feb1d2c0a832e Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 22 Jan 2008 20:44:12 +0000 Subject: [PATCH] - more logging git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4368 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Bookmarks.java | 2 +- source/de/anomic/kelondro/kelondroEcoTable.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java index 0b5188b32..9ce1f4365 100644 --- a/htroot/Bookmarks.java +++ b/htroot/Bookmarks.java @@ -358,7 +358,7 @@ public class Bookmarks { tag=(Tag) it.next(); if (tag.getFriendlyName().startsWith("/")) { path = tag.getFriendlyName(); - while(!path.equals("")){ + while(path.length() > 0){ folders.add(path); path = path.replaceAll("(/.[^/]*$)", ""); serverLog.logInfo("BOOKMARKS", "Path: "+path+" added to folder list.\n"); diff --git a/source/de/anomic/kelondro/kelondroEcoTable.java b/source/de/anomic/kelondro/kelondroEcoTable.java index cdca3fe33..a3143496b 100644 --- a/source/de/anomic/kelondro/kelondroEcoTable.java +++ b/source/de/anomic/kelondro/kelondroEcoTable.java @@ -102,9 +102,18 @@ public class kelondroEcoTable implements kelondroIndex { ((useTailCache == tailCacheForceUsage) || ((useTailCache == tailCacheUsageAuto) && (serverMemory.request(neededRAM4table, false))))) ? new kelondroRowSet(taildef, records) : null; - System.out.println("*** DEBUG: 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; + if (!serverMemory.request(neededRAM4index, false)) { + // 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 + // for the index + System.out.println("*** DEBUG " + tablefile + ": not enough RAM (" + (serverMemory.available() / 1024 / 1024) + "MB) left for index, deleting allocated table space to enable index space allocation (needed: " + (neededRAM4index / 1024 / 1024) + "MB)"); + table = null; System.gc(); + System.out.println("*** DEBUG " + tablefile + ": RAM after releasing the table: " + (serverMemory.available() / 1024 / 1024) + "MB"); + } index = new kelondroBytesIntMap(rowdef.primaryKeyLength, rowdef.objectOrder, records); - System.out.println("*** DEBUG: EcoTable " + tablefile.toString() + " has table copy " + ((table == null) ? "DISABLED" : "ENABLED")); + System.out.println("*** DEBUG " + tablefile + ": EcoTable " + tablefile.toString() + " has table copy " + ((table == null) ? "DISABLED" : "ENABLED")); // read all elements from the file into the copy table byte[] record = new byte[rowdef.objectsize]; @@ -124,7 +133,7 @@ public class kelondroEcoTable implements kelondroIndex { // check consistency ArrayList doubles = index.removeDoubles(); if (doubles.size() > 0) { - System.out.println("DEBUG: WARNING - EcoTable " + tablefile + " has " + doubles.size() + " doubles"); + System.out.println("DEBUG " + tablefile + ": WARNING - EcoTable " + tablefile + " has " + doubles.size() + " doubles"); } } catch (FileNotFoundException e) { // should never happen