From aa083fc45c15d041390889cbd2f20c138d9a0791 Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 13 Apr 2010 11:39:54 +0000 Subject: [PATCH] try to get a fix for OOM problem in case that there is no real problem with missing memory. See also http://forum.yacy-websuche.de/viewtopic.php?p=19835#p19835 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6802 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/net/yacy/kelondro/index/RowCollection.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/net/yacy/kelondro/index/RowCollection.java b/source/net/yacy/kelondro/index/RowCollection.java index 44fd1dbc2..e51c47399 100644 --- a/source/net/yacy/kelondro/index/RowCollection.java +++ b/source/net/yacy/kelondro/index/RowCollection.java @@ -234,7 +234,15 @@ public class RowCollection implements Iterable { System.arraycopy(chunkcache, 0, newChunkcache, 0, chunkcache.length); chunkcache = newChunkcache; } catch (OutOfMemoryError e) { - throw new RowSpaceExceededException(allocram, "RowCollection grow after OutOfMemoryError " + e.getMessage()); + // lets try again after a forced gc() + System.gc(); + try { + final byte[] newChunkcache = new byte[(int) allocram]; // increase space + System.arraycopy(chunkcache, 0, newChunkcache, 0, chunkcache.length); + chunkcache = newChunkcache; + } catch (OutOfMemoryError ee) { + throw new RowSpaceExceededException(allocram, "RowCollection grow after OutOfMemoryError " + ee.getMessage()); + } } }