nodejs/node · critical
Error allocating memory for pkgDataFlags.\n
Error message
Error allocating memory for pkgDataFlags.\n
What it means
uprv_malloc() returned nullptr when allocating the pkgDataFlags pointer array itself (sizeof(char*) * PKGDATA_FLAGS_SIZE). This is an out-of-memory condition at the very start of initializePkgDataFlags(). The tool cannot proceed without the flags array and exits with -1.
Source
Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:872
UErrorCode status = U_ZERO_ERROR;
int32_t result = 0;
int32_t currentBufferSize = SMALL_BUFFER_MAX_SIZE;
int32_t tmpResult = 0;
/* Initialize pkgdataFlags */
pkgDataFlags = static_cast<char**>(uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE));
/* If we run out of space, allocate more */
#if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
do {
#endif
if (pkgDataFlags != nullptr) {
for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
pkgDataFlags[i] = static_cast<char*>(uprv_malloc(sizeof(char) * currentBufferSize));
if (pkgDataFlags[i] != nullptr) {
pkgDataFlags[i][0] = 0;
} else {
fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
/* If an error occurs, ensure that the rest of the array is nullptr */
for (int32_t n = i + 1; n < PKGDATA_FLAGS_SIZE; n++) {
pkgDataFlags[n] = nullptr;
}
return -1;
}
}
} else {
fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
return -1;
}
if (o->options == nullptr) {
return result;
}
#if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
/* Read in options file. */View on GitHub (pinned to 1b2de5e052)
Solutions
- Free system memory or increase available memory (close other processes, increase VM/container memory).
- Reduce parallelism in the build (fewer -j jobs).
- Check and raise the memory ulimit: 'ulimit -v unlimited'.
- If building in a container, increase its memory limit.
Defensive patterns
Strategy: validation
Validate before calling
// Before running pkgdata, check available memory
#include <sys/sysinfo.h>
bool checkMemoryAvailable() {
struct sysinfo info;
if (sysinfo(&info) == 0) {
unsigned long avail = info.freeram * info.mem_unit;
return avail > (16 * 1024 * 1024); // need at least 16MB free
}
return true; // can't check, allow attempt
} Prevention
- Monitor memory usage during builds; reduce -j parallelism if memory is tight.
- Increase container/VM memory limits for build jobs.
- Check 'ulimit -v' and raise it if necessary.
When it happens
Trigger: System is severely memory-constrained when pkgdata starts up. PKGDATA_FLAGS_SIZE entries of char* could not be allocated. This is the outer allocation failing before any individual flag strings are allocated.
Common situations: Running pkgdata in a memory-limited container or VM; ulimit set too low; extremely large PKGDATA_FLAGS_SIZE due to a misconfigured build; system under heavy memory pressure from parallel builds.
Related errors
- U_MEMORY_ALLOCATION_ERROR
- U_MEMORY_ALLOCATION_ERROR
- out of memory\n
- U_MEMORY_ALLOCATION_ERROR
- U_MEMORY_ALLOCATION_ERROR
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/43d0f88855c8d0b9.
Report an issue: GitHub.