nodejs/node · critical

U_MEMORY_ALLOCATION_ERROR

U_MEMORY_ALLOCATION_ERROR

Error message

icupkg: not enough memory

What it means

icupkg allocates its top-level Package with `new Package` and defensively checks for nullptr (the build evidently uses nothrow allocation semantics). If allocation fails it prints "icuexportdata: not enough memory" and returns U_MEMORY_ALLOCATION_ERROR before any package processing. Allocation fails when the process cannot get enough heap for the package data.

Source

Thrown at deps/icu-small/source/tools/icupkg/icupkg.cpp:287

    int result = 0;

    Package *pkg, *listPkg, *addListPkg;

    U_MAIN_INIT_ARGS(argc, argv);

    /* get the program basename */
    pname=findBasename(argv[0]);

    argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);
    isHelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].doesOccur;
    if(isHelp) {
        printUsage(pname, true);
        return U_ZERO_ERROR;
    }

    pkg=new Package;
    if(pkg==nullptr) {
        fprintf(stderr, "icupkg: not enough memory\n");
        return U_MEMORY_ALLOCATION_ERROR;
    }
    isModified=false;

    int autoPrefix=0;
    if(options[OPT_AUTO_TOC_PREFIX].doesOccur) {
        pkg->setAutoPrefix();
        ++autoPrefix;
    }
    if(options[OPT_AUTO_TOC_PREFIX_WITH_TYPE].doesOccur) {
        if(options[OPT_TOC_PREFIX].doesOccur) {
            fprintf(stderr, "icupkg: --auto_toc_prefix_with_type and also --toc_prefix\n");
            printUsage(pname, false);
            return U_ILLEGAL_ARGUMENT_ERROR;
        }
        pkg->setAutoPrefixWithType();
        ++autoPrefix;
    }

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Free memory or raise the limit (`ulimit -v`, cgroup `memory.max`, or move to a larger host).
  2. Reduce the size of the input package (fewer/smaller items).
  3. Run icupkg with fewer concurrent processes.
Defensive patterns

Strategy: validation

Validate before calling

# bash: refuse to run icupkg with dangerously little free memory
free_kb="$(awk '/MemAvailable/ {print $2}' /proc/meminfo 2>/dev/null)"
[ -n "$free_kb" ] && [ "$free_kb" -lt 262144 ] && { echo "insufficient memory for icupkg" >&2; exit 2; }
icupkg "$@"

Try / catch

# treat OOM as retryable transient pressure in CI
for i in 1 2 3; do
  icupkg "$@" && exit 0
  rc=$?
  [ $rc -eq 7 ] || exit $rc   # U_MEMORY_ALLOCATION_ERROR == 7
  sleep 5
done
exit $rc

Prevention

When it happens

Trigger: Very low free memory, a hard ulimit/cgroup memory cap, or an input package so large the initial Package object cannot be allocated.

Common situations: CI containers with tight memory limits; building very large custom ICU data packages; concurrent heavy builds competing for RAM.

Related errors


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