oracle/graal · error · OutOfMemoryError

Failed to allocate array in the host VM.

Error message

Failed to allocate array in the host VM.

What it means

Error "Failed to allocate array in the host VM." thrown in oracle/graal.

Source

Thrown at sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNIUtil.java:594

    }

    public static boolean[] createArray(JNIEnv env, JBooleanArray booleanArray) {
        if (booleanArray.isNull()) {
            return null;
        }
        int len = GetArrayLength(env, booleanArray);
        boolean[] booleans = new boolean[len];
        arrayCopy(env, booleanArray, 0, booleans, 0, len);
        return booleans;
    }

    public static JBooleanArray createHSArray(JNIEnv jniEnv, boolean[] a) {
        if (a == null) {
            return WordFactory.nullPointer();
        }
        JBooleanArray array = NewBooleanArray(jniEnv, a.length);
        if (array.isNull()) {
            throw new OutOfMemoryError("Failed to allocate array in the host VM.");
        }
        arrayCopy(jniEnv, a, 0, array, 0, a.length);
        return array;
    }

    public static byte[] createArray(JNIEnv env, JByteArray byteArray) {
        if (byteArray.isNull()) {
            return null;
        }
        int len = GetArrayLength(env, byteArray);
        byte[] bytes = new byte[len];
        arrayCopy(env, byteArray, 0, bytes, 0, len);
        return bytes;
    }

    public static JByteArray createHSArray(JNIEnv jniEnv, byte[] a) {
        if (a == null) {
            return WordFactory.nullPointer();

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Failed to allocate array in the host VM.
  2. Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call.

Example fix

Validate inputs and environment so that the failing condition does not occur: Failed to allocate array in the host VM.

When it happens

Trigger: Thrown at sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNIUtil.java:594 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Failed to allocate array in the host VM.


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/ce32076b2151353b. Report an issue: GitHub.