nodejs/node · critical

U_MEMORY_ALLOCATION_ERROR

U_MEMORY_ALLOCATION_ERROR

Error message

icupkg: not enough memory\n

What it means

readList does `new Package()` and checks for NULL to detect allocation failure, printing 'icupkg: not enough memory' and exit(U_MEMORY_ALLOCATION_ERROR). In practice standard C++ new throws std::bad_alloc rather than returning NULL, so this branch is essentially unreachable unless operator new is non-throwing.

Source

Thrown at deps/icu-small/source/tools/toolutil/pkg_icu.cpp:72

 * (in the system/ invariant charset).
 * If the listname ends with ".dat", then read the ICU .dat package file.
 * Otherwise, read the file itself as a single-item list.
 */
U_CAPI Package * U_EXPORT2
readList(const char *filesPath, const char *listname, UBool readContents, Package *listPkgIn) {
    Package *listPkg = listPkgIn;
    FILE *file;
    const char *listNameEnd;

    if(listname==nullptr || listname[0]==0) {
        fprintf(stderr, "missing list file\n");
        return nullptr;
    }

    if (listPkg == nullptr) {
        listPkg=new Package();
        if(listPkg==nullptr) {
            fprintf(stderr, "icupkg: not enough memory\n");
            exit(U_MEMORY_ALLOCATION_ERROR);
        }
    }

    listNameEnd=strchr(listname, 0);
    if(isListTextFile(listname)) {
        // read the list file
        char line[1024];
        char *end;
        const char *start;

        file=fopen(listname, "r");
        if(file==nullptr) {
            fprintf(stderr, "icupkg: unable to open list file \"%s\"\n", listname);
            delete listPkg;
            exit(U_FILE_ACCESS_ERROR);
        }

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Raise the available memory for the build (ulimit -v, container/cgroup limit, swap).
  2. Reduce concurrent build parallelism so fewer large processes run at once (-j1).
  3. Check for a genuine memory leak or runaway in the build with a smaller repro.
  4. Add swap or move the build to a host with more RAM.

Example fix

# before
( ulimit -v 524288; icupkg ... )   # OOM -> exit 973
# after
ulimit -v unlimited; icupkg ...
Defensive patterns

Strategy: validation

Validate before calling

# ensure adequate memory before running icupkg
ulimit -v unlimited 2>/dev/null || true
test "$(awk '/MemAvailable/ {print $2}' /proc/meminfo 2>/dev/null)" -gt 524288 || echo "low memory warning" >&2

Prevention

When it happens

Trigger: Severe memory exhaustion at the moment readList constructs its Package; or a build configured with nothrow new. The check `if(listPkg==nullptr)` after `new Package()` is the trigger.

Common situations: A memory-constrained container/CI hitting OOM while packaging; extremely rarely under normal new semantics. More likely indicates the process was already near the memory ceiling.

Related errors


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