mirror of https://github.com/apache/lucene.git
ignore OOME
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1344938 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d65ba8d79e
commit
397d0343d3
|
@ -291,16 +291,33 @@ public class TestPackedInts extends LuceneTestCase {
|
|||
int INDEX = (int)Math.pow(2, 30)+1;
|
||||
int BITS = 2;
|
||||
|
||||
Packed64 p64 = new Packed64(INDEX, BITS);
|
||||
p64.set(INDEX-1, 1);
|
||||
assertEquals("The value at position " + (INDEX-1)
|
||||
+ " should be correct for Packed64", 1, p64.get(INDEX-1));
|
||||
p64 = null;
|
||||
Packed64 p64 = null;
|
||||
try {
|
||||
p64 = new Packed64(INDEX, BITS);
|
||||
} catch (OutOfMemoryError oome) {
|
||||
// This can easily happen: we're allocating a
|
||||
// long[] that needs 256-273 MB. Heap is 512 MB,
|
||||
// but not all of that is available for large
|
||||
// objects ... empirical testing shows we only
|
||||
// have ~ 67 MB free.
|
||||
}
|
||||
if (p64 != null) {
|
||||
p64.set(INDEX-1, 1);
|
||||
assertEquals("The value at position " + (INDEX-1)
|
||||
+ " should be correct for Packed64", 1, p64.get(INDEX-1));
|
||||
p64 = null;
|
||||
}
|
||||
|
||||
for (int bits = 1; bits <=64; ++bits) {
|
||||
if (Packed64SingleBlock.isSupported(bits)) {
|
||||
int index = Integer.MAX_VALUE / bits + (bits == 1 ? 0 : 1);
|
||||
Packed64SingleBlock p64sb = Packed64SingleBlock.create(index, bits);
|
||||
Packed64SingleBlock p64sb = null;
|
||||
try {
|
||||
p64sb = Packed64SingleBlock.create(index, bits);
|
||||
} catch (OutOfMemoryError oome) {
|
||||
// Ignore: see comment above
|
||||
continue;
|
||||
}
|
||||
p64sb.set(index - 1, 1);
|
||||
assertEquals("The value at position " + (index-1)
|
||||
+ " should be correct for " + p64sb.getClass().getSimpleName(),
|
||||
|
@ -309,18 +326,32 @@ public class TestPackedInts extends LuceneTestCase {
|
|||
}
|
||||
|
||||
int index = Integer.MAX_VALUE / 24 + 1;
|
||||
Packed8ThreeBlocks p8 = new Packed8ThreeBlocks(index);
|
||||
p8.set(index - 1, 1);
|
||||
assertEquals("The value at position " + (index-1)
|
||||
+ " should be correct for Packed8ThreeBlocks", 1, p8.get(index-1));
|
||||
p8 = null;
|
||||
Packed8ThreeBlocks p8 = null;
|
||||
try {
|
||||
p8 = new Packed8ThreeBlocks(index);
|
||||
} catch (OutOfMemoryError oome) {
|
||||
// Ignore: see comment above
|
||||
}
|
||||
if (p8 != null) {
|
||||
p8.set(index - 1, 1);
|
||||
assertEquals("The value at position " + (index-1)
|
||||
+ " should be correct for Packed8ThreeBlocks", 1, p8.get(index-1));
|
||||
p8 = null;
|
||||
}
|
||||
|
||||
index = Integer.MAX_VALUE / 48 + 1;
|
||||
Packed16ThreeBlocks p16 = new Packed16ThreeBlocks(index);
|
||||
p16.set(index - 1, 1);
|
||||
assertEquals("The value at position " + (index-1)
|
||||
+ " should be correct for Packed16ThreeBlocks", 1, p16.get(index-1));
|
||||
p16 = null;
|
||||
Packed16ThreeBlocks p16 = null;
|
||||
try {
|
||||
p16 = new Packed16ThreeBlocks(index);
|
||||
} catch (OutOfMemoryError oome) {
|
||||
// Ignore: see comment above
|
||||
}
|
||||
if (p16 != null) {
|
||||
p16.set(index - 1, 1);
|
||||
assertEquals("The value at position " + (index-1)
|
||||
+ " should be correct for Packed16ThreeBlocks", 1, p16.get(index-1));
|
||||
p16 = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue