{"record":{"id":"ce32076b2151353b","repo":"oracle/graal","slug":"failed-to-allocate-array-in-the-host-vm","errorCode":null,"errorMessage":"Failed to allocate array in the host VM.","messagePattern":"Failed to allocate array in the host VM\\.","errorType":"exception","errorClass":"OutOfMemoryError","httpStatus":null,"severity":"error","filePath":"sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNIUtil.java","lineNumber":594,"sourceCode":"    }\n\n    public static boolean[] createArray(JNIEnv env, JBooleanArray booleanArray) {\n        if (booleanArray.isNull()) {\n            return null;\n        }\n        int len = GetArrayLength(env, booleanArray);\n        boolean[] booleans = new boolean[len];\n        arrayCopy(env, booleanArray, 0, booleans, 0, len);\n        return booleans;\n    }\n\n    public static JBooleanArray createHSArray(JNIEnv jniEnv, boolean[] a) {\n        if (a == null) {\n            return WordFactory.nullPointer();\n        }\n        JBooleanArray array = NewBooleanArray(jniEnv, a.length);\n        if (array.isNull()) {\n            throw new OutOfMemoryError(\"Failed to allocate array in the host VM.\");\n        }\n        arrayCopy(jniEnv, a, 0, array, 0, a.length);\n        return array;\n    }\n\n    public static byte[] createArray(JNIEnv env, JByteArray byteArray) {\n        if (byteArray.isNull()) {\n            return null;\n        }\n        int len = GetArrayLength(env, byteArray);\n        byte[] bytes = new byte[len];\n        arrayCopy(env, byteArray, 0, bytes, 0, len);\n        return bytes;\n    }\n\n    public static JByteArray createHSArray(JNIEnv jniEnv, byte[] a) {\n        if (a == null) {\n            return WordFactory.nullPointer();","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNIUtil.java#L576-L612","documentation":"Error \"Failed to allocate array in the host VM.\" thrown in oracle/graal.","triggerScenarios":"Thrown at sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNIUtil.java:594 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Failed to allocate array in the host VM.","solutions":["Fix the condition reported by the error: Failed to allocate array in the host VM.","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: Failed to allocate array in the host VM.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}