{"record":{"id":"107a03a9fc3dc00b","repo":"nodejs/node","slug":"u-memory-allocation-error","errorCode":"U_MEMORY_ALLOCATION_ERROR","errorMessage":"out of memory error","messagePattern":"out of memory error","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"deps/icu-small/source/tools/genrb/genrb.cpp","lineNumber":340,"sourceCode":"\n    initParser();\n\n    /*added by Jing*/\n    if(options[LANGUAGE].doesOccur) {\n        language = options[LANGUAGE].value;\n    }\n\n    LocalPointer<SRBRoot> newPoolBundle;\n    if(options[WRITE_POOL_BUNDLE].doesOccur) {\n        newPoolBundle.adoptInsteadAndCheckErrorCode(new SRBRoot(nullptr, true, status), status);\n        if(U_FAILURE(status)) {\n            fprintf(stderr, \"unable to create an empty bundle for the pool keys: %s\\n\", u_errorName(status));\n            return status;\n        } else {\n            const char *poolResName = \"pool.res\";\n            char *nameWithoutSuffix = static_cast<char *>(uprv_malloc(uprv_strlen(poolResName) + 1));\n            if (nameWithoutSuffix == nullptr) {\n                fprintf(stderr, \"out of memory error\\n\");\n                return U_MEMORY_ALLOCATION_ERROR;\n            }\n            uprv_strcpy(nameWithoutSuffix, poolResName);\n            *uprv_strrchr(nameWithoutSuffix, '.') = 0;\n            newPoolBundle->fLocale = nameWithoutSuffix;\n        }\n    }\n\n    if(options[USE_POOL_BUNDLE].doesOccur) {\n        const char *poolResName = \"pool.res\";\n        FileStream *poolFile;\n        int32_t poolFileSize;\n        int32_t indexLength;\n        /*\n         * TODO: Consolidate inputDir/filename handling from main() and processFile()\n         * into a common function, and use it here as well.\n         * Try to create toolutil functions for dealing with dir/filenames and\n         * loading ICU data files without udata_open().","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/genrb.cpp#L322-L358","documentation":"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.","triggerScenarios":"Identical entry path as error 765 (the --writePoolBundle branch), but failing specifically at the uprv_malloc on genrb.cpp:338 rather than inside SRBRoot.","commonSituations":"memory exhaustion on constrained builders; an allocator hooked into uprv_malloc that is misconfigured or instrumented to fail.","solutions":["Increase available memory / raise container limits and retry.","Run fewer genrb processes in parallel.","If using a custom allocator hook, verify it is not erroneously returning nullptr for small allocations."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# See 765 - same memory preflight applies\nfree_mb=$(awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfo 2>/dev/null || echo 0)\n[ \"$free_mb\" -ge 512 ] || echo \"WARNING: low memory, uprv_malloc may fail\" >&2","typeGuard":null,"tryCatchPattern":"if genrb --writePoolBundle \"$OUT_DIR\" \"$@\" 2>err.log; then :; else\n  if grep -q 'out of memory error' err.log; then\n    echo \"OOM during pool bundle allocation; retry with more memory / less parallelism\" >&2\n  fi\n  exit 1\nfi","preventionTips":["Treat any uprv_malloc failure on a tiny allocation as a signal to stop and free RAM, not to retry in place."],"tags":["icu","genrb","memory","oom","pool-bundle"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}