summaryrefslogtreecommitdiff
path: root/test/2005-pause-all-redefine-multithreaded
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2020-01-06 14:07:26 -0800
committer Treehugger Robot <treehugger-gerrit@google.com> 2020-01-07 09:56:27 +0000
commit455bb387134bda286799ed727d4b33762ef1d5b1 (patch)
tree15ebdabc63d2cb82cd19a02c3b30127ad98e7941 /test/2005-pause-all-redefine-multithreaded
parent467defb0519f45bf4274f9321d826ae8544b9874 (diff)
Make tests 1995, 2001, & 2005 less likely to OOME.
In some situations when run on a severly overloaded machine tests 1995, 2001 and 2005 could fail due to OOMEs being thrown. Limit the amount of memory the tests will use to prevent this from happening. Test: ./test.py --host Bug: 147190668 Change-Id: Ic5ea4405d6638c110456c3119b37c29d6f658bf7
Diffstat (limited to 'test/2005-pause-all-redefine-multithreaded')
-rw-r--r--test/2005-pause-all-redefine-multithreaded/src/art/Test2005.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/2005-pause-all-redefine-multithreaded/src/art/Test2005.java b/test/2005-pause-all-redefine-multithreaded/src/art/Test2005.java
index 6fdadb7a0a..efae915e38 100644
--- a/test/2005-pause-all-redefine-multithreaded/src/art/Test2005.java
+++ b/test/2005-pause-all-redefine-multithreaded/src/art/Test2005.java
@@ -22,6 +22,8 @@ import java.util.concurrent.CountDownLatch;
public class Test2005 {
private static final int NUM_THREADS = 20;
private static final String DEFAULT_VAL = "DEFAULT_VALUE";
+ // Don't perform more than this many repeats per thread to prevent OOMEs
+ private static final int TASK_COUNT_LIMIT = 1000;
public static final class Transform {
public String greetingEnglish;
@@ -108,14 +110,14 @@ public class Test2005 {
public MyThread(CountDownLatch delay, int id) {
super("Thread: " + id);
this.thr_id = id;
- this.results = new ArrayList<>(1000);
+ this.results = new ArrayList<>(TASK_COUNT_LIMIT);
this.finish = false;
this.delay = delay;
}
public void run() {
delay.countDown();
- while (!finish) {
+ while (!finish && results.size() < TASK_COUNT_LIMIT) {
Transform t = new Transform();
results.add(t.sayHi());
}