jitsi/jitsi-meet · error · Error

Failed to create wasm input memory buffer!

Error message

Failed to create wasm input memory buffer!

What it means

RnnoiseProcessor's constructor allocates a wasm heap buffer via _malloc(RNNOISE_BUFFER_SIZE) for the PCM input and throws if the allocation returns 0 (a null pointer in wasm heap terms). A zero return from emscripten's _malloc means the wasm module's heap could not satisfy the allocation — typically because the module wasn't fully initialized, was compiled without ALLOW_MEMORY_GROWTH, or is corrupt/mismatched with the JS glue code.

Source

Thrown at react/features/stream-effects/rnnoise/RnnoiseProcessor.ts:78

    /**
     * Constructor.
     *
     * @class
     * @param {Object} wasmInterface - WebAssembly module interface that exposes rnnoise functionality.
     */
    constructor(wasmInterface: IRnnoiseModule) {
        // Considering that we deal with dynamic allocated memory employ exception safety strong guarantee
        // i.e. in case of exception there are no side effects.
        try {
            this._wasmInterface = wasmInterface;

            // For VAD score purposes only allocate the buffers once and reuse them
            this._wasmPcmInput = this._wasmInterface._malloc(RNNOISE_BUFFER_SIZE);

            this._wasmPcmInputF32Index = this._wasmPcmInput >> 2;

            if (!this._wasmPcmInput) {
                throw Error('Failed to create wasm input memory buffer!');
            }

            this._context = this._wasmInterface._rnnoise_create();
        } catch (error) {
            // release can be called even if not all the components were initialized.
            this.destroy();
            throw error;
        }
    }

    /**
     * Release resources associated with the wasm context. If something goes downhill here
     * i.e. Exception is thrown, there is nothing much we can do.
     *
     * @returns {void}
     */
    _releaseWasmResources(): void {
        // For VAD score purposes only allocate the buffers once and reuse them

View on GitHub (pinned to 98de6219cc)

Solutions

  1. Verify the rnnoise wasm assets are the matching pair shipped with the package version and are correctly served (network tab: rnnoise.wasm loads 200 with expected byte size); rebuild/clean if partially upgraded.
  2. Only construct RnnoiseProcessor after the effect's init/wasm load promise resolves; don't instantiate during module load.
  3. Ensure destroy() is always called on failed/old processors so _free releases the malloc'd buffer and the rnnoise state, avoiding heap exhaustion across sessions.
  4. Re-enable ALLOW_MEMORY_GROWTH (or raise INITIAL_MEMORY) if building a custom rnnoise wasm.

Example fix

// before
const processor = new RnnoiseProcessor(wasmInterface); // may throw 'Failed to create wasm input memory buffer!'

// after
let processor: RnnoiseProcessor | null = null;
try {
    processor = new RnnoiseProcessor(wasmInterface);
} catch (e) {
    logger.error('RNNoise init failed, disabling effect', e);
    // fall back to no noise suppression
    processor = null;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const wasmReady = (iface: { _malloc?: unknown, _rnnoise_create?: unknown }) =>
    typeof iface._malloc === 'function' && typeof iface._rnnoise_create === 'function';
if (wasmReady(wasmInterface)) { new RnnoiseProcessor(wasmInterface); }

Type guard

null

Try / catch

try {
    this._rnnoiseProcessor = new RnnoiseProcessor(wasmInterface);
} catch (e) {
    logger.error('RNNoise unavailable, continuing without noise suppression', e);
    this._rnnoiseProcessor = null; // graceful degradation, no effect applied
}

Prevention

When it happens

Trigger: Instantiating RnnoiseProcessor before the rnnoise wasm module finished instantiating (calling _malloc on an unbuilt module); a wasm build without ALLOW_MEMORY_Growth where initial memory (16MB default) is exhausted; mismatched rnnoise.wasm and rnnoise_processor.js versions after a partial upgrade; memory pressure in long-running sessions after repeated create/destroy cycles leaking heap (destroy not freeing).

Common situations: Bundling issues where the .wasm asset is stale or truncated (webpack copy plugin misconfiguration), Safari/older browsers with wasm memory limits, enabling the noise suppression effect too early in app startup, or a version bump of the rnnoise package without rebuilding assets.


AI-assisted analysis of jitsi/jitsi-meet@98de6219cc (2026-08-28). Data as JSON: /api/errors/39208633a5fa986a. Report an issue: GitHub.