Java 类com.sun.jdi.VMOutOfMemoryException 实例源码

项目:jdk8u-jdk    文件:OomDebugTest.java   
@SuppressWarnings("unused") // called via reflection
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);
    }
}
项目:openjdk-jdk10    文件:OomDebugTest.java   
@SuppressWarnings("unused") // called via reflection
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);
    }
}
项目:jdk8u_jdk    文件:OomDebugTest.java   
@SuppressWarnings("unused") // called via reflection
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);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:OomDebugTest.java   
@SuppressWarnings("unused") // called via reflection
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);
    }
}
项目:openjdk-jdk10    文件:JDWPException.java   
RuntimeException toJDIException() {
    switch (errorCode) {
        case JDWP.Error.INVALID_OBJECT:
            return new ObjectCollectedException();
        case JDWP.Error.INVALID_MODULE:
            return new InvalidModuleException();
        case JDWP.Error.VM_DEAD:
            return new VMDisconnectedException();
        case JDWP.Error.OUT_OF_MEMORY:
            return new VMOutOfMemoryException();
        case JDWP.Error.CLASS_NOT_PREPARED:
            return new ClassNotPreparedException();
        case JDWP.Error.INVALID_FRAMEID:
        case JDWP.Error.NOT_CURRENT_FRAME:
            return new InvalidStackFrameException();
        case JDWP.Error.NOT_IMPLEMENTED:
            return new UnsupportedOperationException();
        case JDWP.Error.INVALID_INDEX:
        case JDWP.Error.INVALID_LENGTH:
            return new IndexOutOfBoundsException();
        case JDWP.Error.TYPE_MISMATCH:
            return new InconsistentDebugInfoException();
        case JDWP.Error.INVALID_THREAD:
            return new IllegalThreadStateException();
        default:
            return new InternalException("Unexpected JDWP Error: " + errorCode, errorCode);
    }
}