nodejs/node · critical
U_MEMORY_ALLOCATION_ERROR
U_MEMORY_ALLOCATION_ERROR
Error message
gencmn: unable to allocate memory for line buffer of size %d\n
What it means
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.
Source
Thrown at deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp:132
/* map non-tree separator (such as '\') to tree separator ('/') inplace. */
static void
fixDirToTreePath(char *s);
/* -------------------------------------------------------------------------- */
U_CAPI void U_EXPORT2
createCommonDataFile(const char *destDir, const char *name, const char *entrypointName, const char *type, const char *source, const char *copyRight,
const char *dataFile, uint32_t max_size, UBool sourceTOC, UBool verbose, char *gencmnFileName) {
static char buffer[4096];
char *line;
char *linePtr;
char *s = nullptr;
UErrorCode errorCode=U_ZERO_ERROR;
uint32_t i, fileOffset, basenameOffset, length, nread;
FileStream *in, *file;
line = (char *)uprv_malloc(sizeof(char) * LINE_BUFFER_SIZE);
if (line == nullptr) {
fprintf(stderr, "gencmn: unable to allocate memory for line buffer of size %d\n", LINE_BUFFER_SIZE);
exit(U_MEMORY_ALLOCATION_ERROR);
}
linePtr = line;
maxSize = max_size;
if (destDir == nullptr) {
destDir = u_getDataDirectory();
}
if (name == nullptr) {
name = COMMON_DATA_NAME;
}
if (type == nullptr) {
type = DATA_TYPE;
}
if (source == nullptr) {
source = ".";View on GitHub (pinned to 1b2de5e052)
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.
Example fix
// before make -j$(nproc) # OOM during gencmn // after ( ulimit -v unlimited; make -j2 )
Defensive patterns
Strategy: retry
Validate before calling
# Refuse to start gencmn under memory pressure / low ulimit.
avail=$(awk '/MemAvailable/{print int($2/1024)}' /proc/meminfo 2>/dev/null)
[ "${avail:-999999}" -gt 128 ] || { echo "host low on memory for gencmn"; exit 2; } Try / catch
# Retry gencmn with reduced parallelism / raised ulimit on OOM (exit 7).
for cfg in "-j$(nproc)" "-j2"; do
( ulimit -v unlimited; make $cfg ) && break || { [ $? -eq 7 ] || exit; }
done Prevention
- Cap build parallelism on memory-constrained hosts.
- Raise virtual-memory ulimits for build processes.
- Provide swap for CI runners to absorb peak RSS.
When it happens
Trigger: 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.
Common situations: Memory-constrained CI containers; heavily parallel builds (make -jN) exhausting RAM; a cgroup/ulimit cap that is too low; swap disabled.
Related errors
- Error allocating memory for pkgDataFlags.\n
- U_MEMORY_ALLOCATION_ERROR
- U_MEMORY_ALLOCATION_ERROR
- error in command line argument "%s"\n
- unable to create an empty bundle for the pool keys: %s
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/f17eca13f313ad1f.
Report an issue: GitHub.