ENOMEM
node
system_error
ai_generated
partial
Error: ENOMEM: not enough memory
ID: node/enomem
75%Fix Rate
85%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
System out of memory. Node process or system-wide memory exhaustion.
genericWorkarounds
-
90% success Profile memory usage to find leaks: node --inspect + Chrome DevTools
node --inspect + Chrome DevTools
Sources: https://nodejs.org/en/learn/diagnostics/memory/using-heap-snapshot
-
88% success Process data in streams instead of loading everything into memory
const { createReadStream } = require('fs'); const stream = createReadStream('large-file.json'); stream.on('data', chunk => processChunk(chunk));Sources: https://nodejs.org/api/stream.html
-
85% success Check for common leaks: growing arrays, unclosed connections, event listener accumulation
growing arrays, unclosed connections, event listener accumulation
Dead Ends
Common approaches that don't work:
-
Increase --max-old-space-size to very large value
70% fail
If system RAM is exhausted, increasing V8 heap won't help
-
Add swap space
60% fail
Swap is extremely slow — fix the memory usage instead
Error Chain
Frequently confused with: