From 342ba1049b1465e65430a5eeef6e7bc6a6be90d2 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Tue, 19 Mar 2013 10:32:01 +0100 Subject: [PATCH] - callback fix - memory allocation problem in RowCollection: if memory is too low, do not to try to increase by 1 because this leads to very long execution time and at the end to the same OOM as if we allocate the memory at the moment we need it even if the resource observer states that this memory is not there. To compensate this, the increase size is reduced. --- htroot/portalsearch/yacy-portalsearch.js | 2 +- source/net/yacy/kelondro/index/RowCollection.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htroot/portalsearch/yacy-portalsearch.js b/htroot/portalsearch/yacy-portalsearch.js index dbaf9d6ed..8121347e5 100644 --- a/htroot/portalsearch/yacy-portalsearch.js +++ b/htroot/portalsearch/yacy-portalsearch.js @@ -207,7 +207,7 @@ function yrun() { function yacysearch(clear) { var url = yconf.url + '/yacysearch.json?callback=?' // JSONP (cross domain) request URL - //var url = yconf.url + '/solr/select?wt=yjson&jsonp=?' // JSONP (cross domain) request URL + //var url = yconf.url + '/solr/select?wt=yjson&callback=?' // JSONP (cross domain) request URL if(clear) { $('#ypopup').empty(); diff --git a/source/net/yacy/kelondro/index/RowCollection.java b/source/net/yacy/kelondro/index/RowCollection.java index 523bad0e4..065c641a0 100644 --- a/source/net/yacy/kelondro/index/RowCollection.java +++ b/source/net/yacy/kelondro/index/RowCollection.java @@ -54,7 +54,7 @@ public class RowCollection implements Sortable, Iterable, private static final byte[] EMPTY_CACHE = new byte[0]; public static final long growfactorLarge100 = 140L; - public static final long growfactorSmall100 = 120L; + public static final long growfactorSmall100 = 110L; private static final int isortlimit = 20; private static final int exp_chunkcount = 0; @@ -246,12 +246,11 @@ public class RowCollection implements Sortable, Iterable, long allocram = needed * growfactorLarge100 / 100L; allocram -= allocram % this.rowdef.objectsize; assert allocram > 0 : "elements = " + elements + ", new = " + allocram; - if (allocram <= Integer.MAX_VALUE && MemoryControl.request(allocram, false)) return allocram; + if (allocram <= Integer.MAX_VALUE && MemoryControl.request(allocram, forcegc)) return allocram; allocram = needed * growfactorSmall100 / 100L; allocram -= allocram % this.rowdef.objectsize; assert allocram >= 0 : "elements = " + elements + ", new = " + allocram; - if (allocram <= Integer.MAX_VALUE && MemoryControl.request(allocram, forcegc)) return allocram; - return needed; + return allocram; } private final void ensureSize(final int elements) throws SpaceExceededException {