nodejs/node · critical
U_MEMORY_ALLOCATION_ERROR
U_MEMORY_ALLOCATION_ERROR
Error message
memory allocation (%ld bytes) for file contents failed
What it means
While writing collation tailoring data, genrb allocates an initial 100,000-byte buffer via LocalMemory<uint8_t>::allocateInsteadAndCopy(). If this allocation returns null (system malloc failed), the tool sets U_MEMORY_ALLOCATION_ERROR. This is the initial buffer for CollationDataWriter::writeTailoring output before the actual size is known.
Source
Thrown at deps/icu-small/source/tools/genrb/parse.cpp:1331
}
if (state->icu4xMode) {
char *nameWithoutSuffix = static_cast<char *>(uprv_malloc(uprv_strlen(state->filename) + 1));
if (nameWithoutSuffix == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
res_close(result);
return nullptr;
}
uprv_strcpy(nameWithoutSuffix, state->filename);
*uprv_strrchr(nameWithoutSuffix, '.') = 0;
writeCollationTOML(state->outputdir, nameWithoutSuffix, collationType, t->data, t->settings, status);
uprv_free(nameWithoutSuffix);
}
icu::LocalMemory<uint8_t> buffer;
int32_t capacity = 100000;
uint8_t *dest = buffer.allocateInsteadAndCopy(capacity);
if(dest == nullptr) {
fprintf(stderr, "memory allocation (%ld bytes) for file contents failed\n",
static_cast<long>(capacity));
*status = U_MEMORY_ALLOCATION_ERROR;
res_close(result);
return nullptr;
}
int32_t indexes[icu::CollationDataReader::IX_TOTAL_SIZE + 1];
int32_t totalSize = icu::CollationDataWriter::writeTailoring(
*t, *t->settings, indexes, dest, capacity, intStatus);
if(intStatus == U_BUFFER_OVERFLOW_ERROR) {
intStatus = U_ZERO_ERROR;
capacity = totalSize;
dest = buffer.allocateInsteadAndCopy(capacity);
if(dest == nullptr) {
fprintf(stderr, "memory allocation (%ld bytes) for file contents failed\n",
static_cast<long>(capacity));
*status = U_MEMORY_ALLOCATION_ERROR;
res_close(result);
return nullptr;View on GitHub (pinned to 1b2de5e052)
Solutions
- Check system memory: `free -h` and `dmesg | grep -i 'out of memory'`
- Reduce parallelism in the build (fewer concurrent genrb processes)
- Increase the container's memory limit if running under Docker/Kubernetes
- Check process ulimits: `ulimit -v` and `ulimit -m`
- Close other memory-intensive applications during the build
Defensive patterns
Strategy: validation
Validate before calling
# Check memory availability before running genrb builds
# Ensure at least 500MB free for typical genrb processing
free_mb=$(free -m | awk '/^Mem:/ {print $7}')
[ "$free_mb" -gt 500 ] || { echo "WARNING: only ${free_mb}MB available"; }
# Check container limits if applicable
cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>/dev/null || echo "No cgroup memory limit" Prevention
- Monitor system memory before and during large ICU data builds
- Limit build parallelism (e.g. make -j2 instead of make -j8) when memory is constrained
- Set appropriate container memory limits in Docker/Kubernetes
- Build large locale sets in batches to avoid peak memory pressure
When it happens
Trigger: System out of memory at the point of the initial 100KB buffer allocation. This is a small allocation failing, which means the process or system is under extreme memory pressure — not a size-dependent failure. Can also occur if the process has hit a ulimit or container memory cgroup limit.
Common situations: Running genrb in a memory-constrained container (Docker cgroup limit); parallel genrb processes consuming all available RAM; a system with swap disabled under heavy load; a memory leak in a previous processing step exhausting the address space.
Related errors
- U_MEMORY_ALLOCATION_ERROR
- U_MEMORY_ALLOCATION_ERROR
- --ucadata was used with UCONFIG_NO_COLLATION
- unable to create an empty bundle for the pool keys: %s
- bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/f7f1e9840e49ecc2.
Report an issue: GitHub.