diff options
Diffstat (limited to 'test/044-proxy/src')
-rw-r--r-- | test/044-proxy/src/Main.java | 4 | ||||
-rw-r--r-- | test/044-proxy/src/OOMEOnDispatch.java | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/test/044-proxy/src/Main.java b/test/044-proxy/src/Main.java index e44c122e3d..7b70e65b8c 100644 --- a/test/044-proxy/src/Main.java +++ b/test/044-proxy/src/Main.java @@ -54,4 +54,8 @@ public class Main { private static final HashMap<String, String> proxyClassNameMap = new HashMap<String, String>(); private static int uniqueTestProxyClassNum = 0; + + static native void startJit(); + static native void stopJit(); + static native void waitForCompilation(); } diff --git a/test/044-proxy/src/OOMEOnDispatch.java b/test/044-proxy/src/OOMEOnDispatch.java index 94f267980d..2ee57926ae 100644 --- a/test/044-proxy/src/OOMEOnDispatch.java +++ b/test/044-proxy/src/OOMEOnDispatch.java @@ -32,6 +32,11 @@ public class OOMEOnDispatch implements InvocationHandler { OOMEInterface.class.getClassLoader(), new Class[] { OOMEInterface.class }, handler); + // Stop the JIT to be sure nothing is running that could be resolving classes or causing + // verification. + Main.stopJit(); + Main.waitForCompilation(); + int l = 1024 * 1024; while (l > 8) { try { @@ -40,17 +45,6 @@ public class OOMEOnDispatch implements InvocationHandler { l = l/2; } } - // Have an extra run with the exact size of Method objects. The above loop should have - // filled with enough large objects for simplicity and speed, but ensure exact allocation - // size. - final int methodAsByteArrayLength = 40 - 12; // Method size - byte array overhead. - for (;;) { - try { - storage.add(new byte[methodAsByteArrayLength]); - } catch (OutOfMemoryError e) { - break; - } - } try { inf.foo(); @@ -60,6 +54,8 @@ public class OOMEOnDispatch implements InvocationHandler { storage.clear(); System.out.println("Received OOME"); } + + Main.startJit(); } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { |