Skip to content

Commit 7c36ee4

Browse files
viiryacloud-fan
authored andcommitted
[SPARK-25290][CORE][TEST] Reduce the size of acquired arrays to avoid OOM error
## What changes were proposed in this pull request? `BytesToBytesMapOnHeapSuite`.`randomizedStressTest` caused `OutOfMemoryError` on several test runs. Seems better to reduce memory usage in this test. ## How was this patch tested? Unit tests. Closes apache#22297 from viirya/SPARK-25290. Authored-by: Liang-Chi Hsieh <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
1 parent c5583fd commit 7c36ee4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/test/java/org/apache/spark/unsafe/map/AbstractBytesToBytesMapSuite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public void iteratingOverDataPagesWithWastedSpace() throws Exception {
379379

380380
@Test
381381
public void randomizedStressTest() {
382-
final int size = 65536;
382+
final int size = 32768;
383383
// Java arrays' hashCodes() aren't based on the arrays' contents, so we need to wrap arrays
384384
// into ByteBuffers in order to use them as keys here.
385385
final Map<ByteBuffer, byte[]> expected = new HashMap<>();
@@ -388,7 +388,7 @@ public void randomizedStressTest() {
388388
// Fill the map to 90% full so that we can trigger probing
389389
for (int i = 0; i < size * 0.9; i++) {
390390
final byte[] key = getRandomByteArray(rand.nextInt(256) + 1);
391-
final byte[] value = getRandomByteArray(rand.nextInt(512) + 1);
391+
final byte[] value = getRandomByteArray(rand.nextInt(256) + 1);
392392
if (!expected.containsKey(ByteBuffer.wrap(key))) {
393393
expected.put(ByteBuffer.wrap(key), value);
394394
final BytesToBytesMap.Location loc = map.lookup(

0 commit comments

Comments
 (0)