use of com.sun.jdi.VMOutOfMemoryException in project jdk8u_jdk by JetBrains.
the class OomDebugTest method test2.
/*
* Test case: Array reference as method parameter.
*/
// called via reflection
@SuppressWarnings("unused")
private void test2() throws Exception {
System.out.println("DEBUG: ------------> Running test2");
try {
Field field = targetClass.fieldByName("byteArray");
ArrayType arrType = (ArrayType) field.type();
for (int i = 0; i < 15; i++) {
ArrayReference byteArrayVal = arrType.newInstance(3000000);
if (byteArrayVal.isCollected()) {
System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
continue;
}
invoke("testPrimitive", "([B)V", byteArrayVal);
}
} catch (VMOutOfMemoryException e) {
defaultHandleOOMFailure(e);
}
}
Aggregations