{"record":{"id":"ee5d5941f282c123","repo":"nodejs/node","slug":"u-memory-allocation-error-ee5d59","errorCode":"U_MEMORY_ALLOCATION_ERROR","errorMessage":"icupkg: not enough memory\n","messagePattern":"icupkg: not enough memory\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"deps/icu-small/source/tools/icupkg/icupkg.cpp","lineNumber":287,"sourceCode":"    int result = 0;\n\n    Package *pkg, *listPkg, *addListPkg;\n\n    U_MAIN_INIT_ARGS(argc, argv);\n\n    /* get the program basename */\n    pname=findBasename(argv[0]);\n\n    argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);\n    isHelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].doesOccur;\n    if(isHelp) {\n        printUsage(pname, true);\n        return U_ZERO_ERROR;\n    }\n\n    pkg=new Package;\n    if(pkg==nullptr) {\n        fprintf(stderr, \"icupkg: not enough memory\\n\");\n        return U_MEMORY_ALLOCATION_ERROR;\n    }\n    isModified=false;\n\n    int autoPrefix=0;\n    if(options[OPT_AUTO_TOC_PREFIX].doesOccur) {\n        pkg->setAutoPrefix();\n        ++autoPrefix;\n    }\n    if(options[OPT_AUTO_TOC_PREFIX_WITH_TYPE].doesOccur) {\n        if(options[OPT_TOC_PREFIX].doesOccur) {\n            fprintf(stderr, \"icupkg: --auto_toc_prefix_with_type and also --toc_prefix\\n\");\n            printUsage(pname, false);\n            return U_ILLEGAL_ARGUMENT_ERROR;\n        }\n        pkg->setAutoPrefixWithType();\n        ++autoPrefix;\n    }","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/icupkg/icupkg.cpp#L269-L305","documentation":"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.","triggerScenarios":"Very low free memory, a hard ulimit/cgroup memory cap, or an input package so large the initial Package object cannot be allocated.","commonSituations":"CI containers with tight memory limits; building very large custom ICU data packages; concurrent heavy builds competing for RAM.","solutions":["Free memory or raise the limit (`ulimit -v`, cgroup `memory.max`, or move to a larger host).","Reduce the size of the input package (fewer/smaller items).","Run icupkg with fewer concurrent processes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# bash: refuse to run icupkg with dangerously little free memory\nfree_kb=\"$(awk '/MemAvailable/ {print $2}' /proc/meminfo 2>/dev/null)\"\n[ -n \"$free_kb\" ] && [ \"$free_kb\" -lt 262144 ] && { echo \"insufficient memory for icupkg\" >&2; exit 2; }\nicupkg \"$@\"","typeGuard":null,"tryCatchPattern":"# treat OOM as retryable transient pressure in CI\nfor i in 1 2 3; do\n  icupkg \"$@\" && exit 0\n  rc=$?\n  [ $rc -eq 7 ] || exit $rc   # U_MEMORY_ALLOCATION_ERROR == 7\n  sleep 5\ndone\nexit $rc","preventionTips":["Set cgroup/ulimit memory limits above the package's working-set size.","Build very large packages on a host with ample RAM, not in a tight container."],"tags":["icu","icupkg","memory","oom"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}