{"record":{"id":"f17eca13f313ad1f","repo":"nodejs/node","slug":"u-memory-allocation-error-f17eca","errorCode":"U_MEMORY_ALLOCATION_ERROR","errorMessage":"gencmn: unable to allocate memory for line buffer of size %d\\n","messagePattern":"gencmn: unable to allocate memory for line buffer of size (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp","lineNumber":132,"sourceCode":"/* map non-tree separator (such as '\\') to tree separator ('/') inplace. */\nstatic void\nfixDirToTreePath(char *s);\n/* -------------------------------------------------------------------------- */\n\nU_CAPI void U_EXPORT2\ncreateCommonDataFile(const char *destDir, const char *name, const char *entrypointName, const char *type, const char *source, const char *copyRight,\n                     const char *dataFile, uint32_t max_size, UBool sourceTOC, UBool verbose, char *gencmnFileName) {\n    static char buffer[4096];\n    char *line;\n    char *linePtr;\n    char *s = nullptr;\n    UErrorCode errorCode=U_ZERO_ERROR;\n    uint32_t i, fileOffset, basenameOffset, length, nread;\n    FileStream *in, *file;\n\n    line = (char *)uprv_malloc(sizeof(char) * LINE_BUFFER_SIZE);\n    if (line == nullptr) {\n        fprintf(stderr, \"gencmn: unable to allocate memory for line buffer of size %d\\n\", LINE_BUFFER_SIZE);\n        exit(U_MEMORY_ALLOCATION_ERROR);\n    }\n\n    linePtr = line;\n\n    maxSize = max_size;\n\n    if (destDir == nullptr) {\n        destDir = u_getDataDirectory();\n    }\n    if (name == nullptr) {\n        name = COMMON_DATA_NAME;\n    }\n    if (type == nullptr) {\n        type = DATA_TYPE;\n    }\n    if (source == nullptr) {\n        source = \".\";","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp#L114-L150","documentation":"At the very start of createCommonDataFile, gencmn allocates its line buffer with uprv_malloc(LINE_BUFFER_SIZE); a nullptr return means the host is out of memory, so it exits U_MEMORY_ALLOCATION_ERROR (pkg_gencmn.cpp:132). This is a startup OOM, before any real work.","triggerScenarios":"System is out of memory when gencmn launches, or the process virtual-memory limit (ulimit -v) is too small to satisfy even the initial line-buffer allocation.","commonSituations":"Memory-constrained CI containers; heavily parallel builds (make -jN) exhausting RAM; a cgroup/ulimit cap that is too low; swap disabled.","solutions":["Raise available memory / virtual-memory ulimit for the build.","Reduce parallelism (e.g. make -j2) to cut peak RSS.","Add swap or run gencmn in isolation to confirm it is a host-pressure issue."],"exampleFix":"// before\nmake -j$(nproc)      # OOM during gencmn\n// after\n( ulimit -v unlimited; make -j2 )","handlingStrategy":"retry","validationCode":"# Refuse to start gencmn under memory pressure / low ulimit.\navail=$(awk '/MemAvailable/{print int($2/1024)}' /proc/meminfo 2>/dev/null)\n[ \"${avail:-999999}\" -gt 128 ] || { echo \"host low on memory for gencmn\"; exit 2; }","typeGuard":null,"tryCatchPattern":"# Retry gencmn with reduced parallelism / raised ulimit on OOM (exit 7).\nfor cfg in \"-j$(nproc)\" \"-j2\"; do\n  ( ulimit -v unlimited; make $cfg ) && break || { [ $? -eq 7 ] || exit; }\ndone","preventionTips":["Cap build parallelism on memory-constrained hosts.","Raise virtual-memory ulimits for build processes.","Provide swap for CI runners to absorb peak RSS."],"tags":["icu","build-tool","memory","gencmn"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}