nodejs/node · critical
U_MEMORY_ALLOCATION_ERROR
U_MEMORY_ALLOCATION_ERROR
Error message
Could not allocate memory!!
What it means
In the XLIFF output path's print() function, genrb calls uprv_malloc() to allocate a buffer of srcLen*4 bytes (worst-case for UTF-16 to UTF-8 expansion plus XML escaping). If malloc returns null, the tool immediately exits the process with U_MEMORY_ALLOCATION_ERROR. This is an unconditional process exit, not a recoverable error.
Source
Thrown at deps/icu-small/source/tools/genrb/wrtxml.cpp:411
break;
}
*len = i+1;
}
static void
print(char16_t* src, int32_t srcLen,const char *tagStart,const char *tagEnd, UErrorCode *status){
int32_t bufCapacity = srcLen*4;
char *buf = nullptr;
int32_t bufLen = 0;
if(U_FAILURE(*status)){
return;
}
buf = static_cast<char*>(uprv_malloc(bufCapacity));
if (buf == nullptr) {
fprintf(stderr, "Could not allocate memory!!");
exit(U_MEMORY_ALLOCATION_ERROR);
}
buf = convertAndEscape(&buf, bufCapacity, &bufLen, src, srcLen,status);
if(U_SUCCESS(*status)){
trim(&buf,&bufLen);
write_utf8_file(out,UnicodeString(tagStart));
write_utf8_file(out,UnicodeString(buf, bufLen, "UTF-8"));
write_utf8_file(out,UnicodeString(tagEnd));
write_utf8_file(out,UnicodeString("\n"));
}
}
#endif
static void
printNoteElements(const UString *src, UErrorCode *status){
#if UCONFIG_NO_REGULAR_EXPRESSIONS==0 /* donot compile when no RegularExpressions are available */View on GitHub (pinned to 1b2de5e052)
Solutions
- Check available system memory: `free -h`
- Reduce build parallelism to lower peak memory usage
- Increase container memory limits if applicable
- Investigate whether any string in the resource bundle is unexpectedly large (may indicate data corruption or accidental inclusion of a large file)
- Split large resource bundles into smaller per-locale files to reduce per-process peak memory
Defensive patterns
Strategy: validation
Validate before calling
# Check available memory and string sizes before XLIFF build
free -h
# Find resource bundles with very large strings (potential memory issue for XLIFF output)
for f in data/*.txt; do
size=$(wc -c < "$f")
[ "$size" -gt 1000000 ] && echo "Large bundle file: $f ($size bytes)"
done Prevention
- Ensure sufficient system memory before running genrb with --write-xliff on large bundles
- Split resource bundles with very large strings into smaller files
- Monitor memory usage during XLIFF generation builds
- Reduce build parallelism for XLIFF output to lower peak memory
When it happens
Trigger: System memory exhaustion at the point of allocating the XML output buffer. The buffer size is proportional to the source string length times 4. A very long string or a system under memory pressure can trigger this. Since the tool calls exit(), no cleanup or recovery is possible.
Common situations: Processing a resource bundle with extremely long string values (megabytes of text); system under memory pressure from parallel genrb processes; container with tight memory limits; memory fragmentation after processing many large bundles.
Related errors
- U_MEMORY_ALLOCATION_ERROR
- U_MEMORY_ALLOCATION_ERROR
- unable to create an empty bundle for the pool keys: %s
- bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s
- Could not canonicalize the locale ID: %s. Error: %s
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/fdd0fd9e14a290ed.
Report an issue: GitHub.