summaryrefslogtreecommitdiff
path: root/test/098-ddmc/src/Main.java
diff options
context:
space:
mode:
author Man Cao <manc@google.com> 2015-06-11 15:55:43 -0700
committer Man Cao <manc@google.com> 2015-06-11 17:54:48 -0700
commit0797e5890f0db2a95ad5be840f2999f51aeb731e (patch)
treeca42d0a45fa375192f92a28f2250362b3975946e /test/098-ddmc/src/Main.java
parent8d73a91d8f4c89ac152d18081b07093f68c56a11 (diff)
Skip 098-ddmc for GC stress test
And add comment about the temporary fix in 098-ddmc because of behavior change for DDMS's getRecentAllocations(). Also fixed a buggy typo in Android.run-test.mk. Bug: 20037135 Change-Id: Ia57e03f458d8570690616d2cc49f2ead42a96cb0
Diffstat (limited to 'test/098-ddmc/src/Main.java')
-rw-r--r--test/098-ddmc/src/Main.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/098-ddmc/src/Main.java b/test/098-ddmc/src/Main.java
index f74a17e0ac..4914ba2289 100644
--- a/test/098-ddmc/src/Main.java
+++ b/test/098-ddmc/src/Main.java
@@ -43,7 +43,9 @@ public class Main {
System.out.println("Confirm when we overflow, we don't roll over to zero. b/17392248");
final int overflowAllocations = 64 * 1024; // Won't fit in unsigned 16-bit value.
- // Keep the new objects live so they are not garbage collected.
+ // TODO: Temporary fix. Keep the new objects live so they are not garbage collected.
+ // This will cause OOM exception for GC stress tests. The root cause is changed behaviour of
+ // getRecentAllocations(). Working on restoring its old behaviour. b/20037135
Object[] objects = new Object[overflowAllocations];
for (int i = 0; i < overflowAllocations; i++) {
objects[i] = new Object();
@@ -53,6 +55,12 @@ public class Main {
System.out.println("after > before=" + (after.numberOfEntries > before.numberOfEntries));
System.out.println("after.numberOfEntries=" + after.numberOfEntries);
+ // TODO: Temporary fix as above. b/20037135
+ objects = null;
+ Runtime.getRuntime().gc();
+ final int fillerStrings = 16 * 1024;
+ String[] strings = new String[fillerStrings];
+
System.out.println("Disable and confirm back to empty");
DdmVmInternal.enableRecentAllocations(false);
System.out.println("status=" + DdmVmInternal.getRecentAllocationStatus());
@@ -68,8 +76,8 @@ public class Main {
System.out.println("Confirm we can reenable twice in a row without losing allocations");
DdmVmInternal.enableRecentAllocations(true);
System.out.println("status=" + DdmVmInternal.getRecentAllocationStatus());
- for (int i = 0; i < 16 * 1024; i++) {
- objects[i] = new String("fnord");
+ for (int i = 0; i < fillerStrings; i++) {
+ strings[i] = new String("fnord");
}
Allocations first = new Allocations(DdmVmInternal.getRecentAllocations());
DdmVmInternal.enableRecentAllocations(true);