Skip to content

Commit 7b81a9c

Browse files
Ramkumar Sunderbabulmesnik
authored andcommitted
8289764: gc/lock tests failed with "OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects"
Reviewed-by: lmesnik
1 parent 76ee549 commit 7b81a9c

File tree

50 files changed

+69
-1320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+69
-1320
lines changed

test/hotspot/jtreg/TEST.quick-groups

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,9 +1557,9 @@ vmTestbase_vm_gc_quick = \
15571557
vmTestbase/gc/gctests/StringInternGC/StringInternGC.java \
15581558
vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java \
15591559
vmTestbase/gc/lock/jni/jnilock001/TestDescription.java \
1560-
vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java \
1561-
vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TestDescription.java \
1562-
vmTestbase/gc/lock/malloc/malloclock03/TestDescription.java
1560+
vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java \
1561+
vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java \
1562+
vmTestbase/gc/lock/malloc/malloclock01/TestDescription.java
15631563

15641564
vmTestbase_vm_compiler_quick = \
15651565
vmTestbase/vm/compiler/jbe/constprop/constprop01/constprop01.java \

test/hotspot/jtreg/vmTestbase/gc/lock/LockerTest.java

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,9 +22,10 @@
2222
*/
2323
package gc.lock;
2424

25+
import jdk.test.whitebox.WhiteBox;
2526
import nsk.share.runner.*;
2627
import nsk.share.gc.*;
27-
import nsk.share.gc.gp.*;
28+
import nsk.share.gc.gp.GarbageUtils;
2829
import nsk.share.gc.lock.*;
2930
import nsk.share.test.ExecutionController;
3031

@@ -33,41 +34,37 @@
3334
*
3435
* A number of threads is started. Each one locks and eats memory.
3536
*/
36-
public class LockerTest extends ThreadedGCTest implements GarbageProducerAware, GarbageProducer1Aware, LockersAware {
37+
public class LockerTest extends ThreadedGCTest implements LockersAware {
3738

38-
private GarbageProducer garbageProducer;
39-
private GarbageProducer garbageProducer1;
4039
private Lockers lockers;
4140
private long objectSize = 1000;
4241

4342
private class Worker implements Runnable {
4443

45-
byte[] rezerve = new byte[1024 * 1024];
46-
private Locker locker = lockers.createLocker(garbageProducer1.create(objectSize));
44+
byte[] rezerve = new byte[1024];
45+
private Locker locker = lockers.createLocker(rezerve);
4746

4847
public Worker() {
4948
locker.enable();
5049
}
5150

5251
public void run() {
53-
locker.lock();
54-
GarbageUtils.eatMemory(getExecutionController(), garbageProducer);
55-
locker.unlock();
52+
ExecutionController stresser = getExecutionController();
53+
// Use only 30% of the heap.
54+
final long testMemorySize = 3 * Runtime.getRuntime().maxMemory() / 10;
55+
56+
while (stresser.continueExecution()) {
57+
locker.lock();
58+
GarbageUtils.engageGC(testMemorySize);
59+
locker.unlock();
60+
}
5661
}
5762
}
5863

5964
protected Runnable createRunnable(int i) {
6065
return new Worker();
6166
}
6267

63-
public void setGarbageProducer(GarbageProducer garbageProducer) {
64-
this.garbageProducer = garbageProducer;
65-
}
66-
67-
public void setGarbageProducer1(GarbageProducer garbageProducer1) {
68-
this.garbageProducer1 = garbageProducer1;
69-
}
70-
7168
public void setLockers(Lockers lockers) {
7269
this.lockers = lockers;
7370
}

test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock001/TestDescription.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,10 +31,8 @@
3131
*
3232
* @library /vmTestbase
3333
* /test/lib
34-
* @run main/othervm/native
35-
* -XX:-UseGCOverheadLimit
36-
* gc.lock.LockerTest
37-
* -gp1 randomString
38-
* -lockers jni
34+
* @build jdk.test.whitebox.WhiteBox
35+
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
36+
* @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jni -t 1
3937
*/
4038

test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TEST.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TestDescription.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TEST.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TestDescription.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock01/TestDescription.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,10 +31,8 @@
3131
*
3232
* @library /vmTestbase
3333
* /test/lib
34-
* @run main/othervm/native
35-
* -XX:-UseGCOverheadLimit
36-
* gc.lock.LockerTest
37-
* -gp1 randomString
38-
* -lockers jniGlobalRef
34+
* @build jdk.test.whitebox.WhiteBox
35+
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
36+
* @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jniGlobalRef -t 1
3937
*/
4038

test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TEST.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TestDescription.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)