keep more free mem

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5778 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2009-04-03 14:27:04 +00:00
parent c2359f20dd
commit b887f4a116
2 changed files with 5 additions and 3 deletions

View File

@ -64,7 +64,7 @@ public class BLOBArray implements BLOB {
*/
public static final long oneMonth = 1000L * 60L * 60L * 24L * 365L / 12L;
public static final long oneGigabyte = 1024 * 1024 * 1024;
public static final long oneGigabyte = 1024L * 1024L * 1024L;
private int keylength;
private ByteOrder ordering;

View File

@ -45,6 +45,8 @@ import de.anomic.kelondro.util.Log;
public class HeapReader {
public final static long keepFreeMem = 20 * 1024 * 1024;
protected int keylength; // the length of the primary key
protected LongHandleIndex index; // key/seek relation for used records
protected Gap free; // set of {seek, size} pairs denoting space and position of free records
@ -234,8 +236,8 @@ public class HeapReader {
// access the file and read the container
file.seek(pos);
final int len = file.readInt() - index.row().primaryKeyLength;
if (MemoryControl.available() < len) {
if (!MemoryControl.request(len, true)) return null; // not enough memory available for this blob
if (MemoryControl.available() < len * 2 + keepFreeMem) {
if (!MemoryControl.request(len * 2 + keepFreeMem, true)) return null; // not enough memory available for this blob
}
// read the key