summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-01-11 11:10:09 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-01-11 11:10:09 -0800
commit6d003529ed3badd0f743e80f583f37995f6bf569 (patch)
tree7ab941bdcf7588e7460c6d5dd25063469c8e9eef /test
parenta26babddfce488172648efcd18d8c9e672a71759 (diff)
parent35c360ec8ac11f6298c94eaadc6b534edf59e370 (diff)
downloadart-6d003529ed3badd0f743e80f583f37995f6bf569.zip
art-6d003529ed3badd0f743e80f583f37995f6bf569.tar.gz
art-6d003529ed3badd0f743e80f583f37995f6bf569.tar.bz2
Merge "Don't mask OOMEs in 102-concurrent-gc." into dalvik-dev
Diffstat (limited to 'test')
-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 1a9e88e..f4f697d 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");
}