summaryrefslogtreecommitdiffstats
path: root/test/080-oom-throw
diff options
context:
space:
mode:
authorMark Mendell <mark.p.mendell@intel.com>2014-08-18 22:19:06 -0400
committerMark Mendell <mark.p.mendell@intel.com>2014-08-18 22:19:06 -0400
commit8ed2e706870c05411f0836b291263689aa1c6959 (patch)
treea3805eaaec3847772f6324e57d7462430e0106bd /test/080-oom-throw
parent7df1754ae17acd891995159fc50f3bb176b770dd (diff)
downloadart-8ed2e706870c05411f0836b291263689aa1c6959.zip
art-8ed2e706870c05411f0836b291263689aa1c6959.tar.gz
art-8ed2e706870c05411f0836b291263689aa1c6959.tar.bz2
Fix OOM test case to handle more optimizations
The 080-oom-throw test case has some code in triggerInstanceOOM to exhaust memory. Unfortunately, a sufficiently intelligent compiler can inline the call to memEater.confuseCompilerOptimization and realize that it is a no-op. In that case, the memEater variable is dead, and if a compiler can improve the GC map, the only live heap data will be the last allocated chunk. Fix this by ensuring that the start of the chain (memEater) is really live. Also ensure that it becomes dead before exiting the method, or the subsequent println will fail allocating memory. Change-Id: I345ebc3e19bd86e176c616ff18bcac4ed8dbb419 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
Diffstat (limited to 'test/080-oom-throw')
-rw-r--r--test/080-oom-throw/src/Main.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/080-oom-throw/src/Main.java b/test/080-oom-throw/src/Main.java
index 035690f..c93f8bb 100644
--- a/test/080-oom-throw/src/Main.java
+++ b/test/080-oom-throw/src/Main.java
@@ -31,6 +31,7 @@ public class Main {
static class InstanceMemEater {
static boolean sawOome;
+ static InstanceMemEater hook;
InstanceMemEater next;
double d1, d2, d3, d4, d5, d6, d7, d8; // Bloat this object so we fill the heap faster.
@@ -45,6 +46,7 @@ public class Main {
}
static void confuseCompilerOptimization(InstanceMemEater instance) {
+ hook = instance;
}
}
@@ -61,6 +63,7 @@ public class Main {
lastMemEater = lastMemEater.next;
} while (lastMemEater != null);
memEater.confuseCompilerOptimization(memEater);
+ InstanceMemEater.hook = null;
return InstanceMemEater.sawOome;
}