nodejs/node · critical

U_MEMORY_ALLOCATION_ERROR

U_MEMORY_ALLOCATION_ERROR

Error message

out of memory error

What it means

uprv_malloc(strlen("pool.res")+1) returned nullptr while allocating a small buffer to hold the locale name for the pool bundle. genrb prints "out of memory error" and returns U_MEMORY_ALLOCATION_ERROR. Because the requested allocation is tiny (~8 bytes), a failure here signals the process is already deep into OOM.

Source

Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:340

    initParser();

    /*added by Jing*/
    if(options[LANGUAGE].doesOccur) {
        language = options[LANGUAGE].value;
    }

    LocalPointer<SRBRoot> newPoolBundle;
    if(options[WRITE_POOL_BUNDLE].doesOccur) {
        newPoolBundle.adoptInsteadAndCheckErrorCode(new SRBRoot(nullptr, true, status), status);
        if(U_FAILURE(status)) {
            fprintf(stderr, "unable to create an empty bundle for the pool keys: %s\n", u_errorName(status));
            return status;
        } else {
            const char *poolResName = "pool.res";
            char *nameWithoutSuffix = static_cast<char *>(uprv_malloc(uprv_strlen(poolResName) + 1));
            if (nameWithoutSuffix == nullptr) {
                fprintf(stderr, "out of memory error\n");
                return U_MEMORY_ALLOCATION_ERROR;
            }
            uprv_strcpy(nameWithoutSuffix, poolResName);
            *uprv_strrchr(nameWithoutSuffix, '.') = 0;
            newPoolBundle->fLocale = nameWithoutSuffix;
        }
    }

    if(options[USE_POOL_BUNDLE].doesOccur) {
        const char *poolResName = "pool.res";
        FileStream *poolFile;
        int32_t poolFileSize;
        int32_t indexLength;
        /*
         * TODO: Consolidate inputDir/filename handling from main() and processFile()
         * into a common function, and use it here as well.
         * Try to create toolutil functions for dealing with dir/filenames and
         * loading ICU data files without udata_open().

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Increase available memory / raise container limits and retry.
  2. Run fewer genrb processes in parallel.
  3. If using a custom allocator hook, verify it is not erroneously returning nullptr for small allocations.
Defensive patterns

Strategy: try-catch

Validate before calling

# See 765 - same memory preflight applies
free_mb=$(awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfo 2>/dev/null || echo 0)
[ "$free_mb" -ge 512 ] || echo "WARNING: low memory, uprv_malloc may fail" >&2

Try / catch

if genrb --writePoolBundle "$OUT_DIR" "$@" 2>err.log; then :; else
  if grep -q 'out of memory error' err.log; then
    echo "OOM during pool bundle allocation; retry with more memory / less parallelism" >&2
  fi
  exit 1
fi

Prevention

When it happens

Trigger: Identical entry path as error 765 (the --writePoolBundle branch), but failing specifically at the uprv_malloc on genrb.cpp:338 rather than inside SRBRoot.

Common situations: memory exhaustion on constrained builders; an allocator hooked into uprv_malloc that is misconfigured or instrumented to fail.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/107a03a9fc3dc00b. Report an issue: GitHub.