summaryrefslogtreecommitdiffstats
path: root/test/102-concurrent-gc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-01-11 10:45:46 -0800
committerIan Rogers <irogers@google.com>2013-01-11 10:45:46 -0800
commit35c360ec8ac11f6298c94eaadc6b534edf59e370 (patch)
treebccda843a8bd471cb2f6bf38033383e4ceb7c4be /test/102-concurrent-gc
parentfef2a2947258a6e25b860061151932ff83fa81a2 (diff)
downloadandroid_art-35c360ec8ac11f6298c94eaadc6b534edf59e370.tar.gz
android_art-35c360ec8ac11f6298c94eaadc6b534edf59e370.tar.bz2
android_art-35c360ec8ac11f6298c94eaadc6b534edf59e370.zip
Don't mask OOMEs in 102-concurrent-gc.
Change-Id: Iccc38d5a7acf72dcca5baa5aade2df739aab3183
Diffstat (limited to 'test/102-concurrent-gc')
-rw-r--r--test/102-concurrent-gc/src/Main.java59
1 files changed, 28 insertions, 31 deletions
diff --git a/test/102-concurrent-gc/src/Main.java b/test/102-concurrent-gc/src/Main.java
index 1a9e88eba2..f4f697dc29 100644
--- a/test/102-concurrent-gc/src/Main.java
+++ b/test/102-concurrent-gc/src/Main.java
@@ -25,42 +25,39 @@ public class Main {
}
public static void main(String[] args) throws Exception {
- try {
- ByteContainer[] l = new ByteContainer[buckets];
+ ByteContainer[] l = new ByteContainer[buckets];
- for (int i = 0; i < buckets; ++i) {
- l[i] = new ByteContainer();
- }
+ for (int i = 0; i < buckets; ++i) {
+ l[i] = new ByteContainer();
+ }
- Random rnd = new Random(123456);
- for (int i = 0; i < buckets / 256; ++i) {
- int index = rnd.nextInt(buckets);
- l[index].bytes = new byte[bufferSize];
+ Random rnd = new Random(123456);
+ for (int i = 0; i < buckets / 256; ++i) {
+ int index = rnd.nextInt(buckets);
+ l[index].bytes = new byte[bufferSize];
- // Try to get GC to run if we can
- Runtime.getRuntime().gc();
+ // Try to get GC to run if we can
+ Runtime.getRuntime().gc();
- // Shuffle the array to try cause the lost object problem:
- // This problem occurs when an object is white, it may be
- // only referenced from a white or grey object. If the white
- // object is moved during a CMS to be a black object's field, it
- // causes the moved object to not get marked. This can result in
- // heap corruption. A typical way to address this issue is by
- // having a card table.
- // This aspect of the test is meant to ensure that card
- // dirtying works and that we check the marked cards after
- // marking.
- // If these operations are not done, a segfault / failed assert
- // should occur.
- for (int j = 0; j < l.length; ++j) {
- int a = l.length - i - 1;
- int b = rnd.nextInt(a);
- byte[] temp = l[a].bytes;
- l[a].bytes = l[b].bytes;
- l[b].bytes = temp;
- }
+ // Shuffle the array to try cause the lost object problem:
+ // This problem occurs when an object is white, it may be
+ // only referenced from a white or grey object. If the white
+ // object is moved during a CMS to be a black object's field, it
+ // causes the moved object to not get marked. This can result in
+ // heap corruption. A typical way to address this issue is by
+ // having a card table.
+ // This aspect of the test is meant to ensure that card
+ // dirtying works and that we check the marked cards after
+ // marking.
+ // If these operations are not done, a segfault / failed assert
+ // should occur.
+ for (int j = 0; j < l.length; ++j) {
+ int a = l.length - i - 1;
+ int b = rnd.nextInt(a);
+ byte[] temp = l[a].bytes;
+ l[a].bytes = l[b].bytes;
+ l[b].bytes = temp;
}
- } catch (OutOfMemoryError e) {
}
System.out.println("Test complete");
}