From 0797e5890f0db2a95ad5be840f2999f51aeb731e Mon Sep 17 00:00:00 2001 From: Man Cao Date: Thu, 11 Jun 2015 15:55:43 -0700 Subject: 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 --- test/098-ddmc/src/Main.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'test/098-ddmc/src/Main.java') 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); -- cgit v1.2.3-59-g8ed1b