Node.js 27 Halves Default Heap Limit, Counts Buffers in Heap
Node.js 27 alpha halves the default heap limit to half of physical memory (capped at 4GB) and begins counting Buffer and ArrayBuffer memory toward that limit, risking OOM errors on upgrade; also adds V8 15.6 features, native fs.glob, and a longer keepAlive timeout.
Heap Limit Calculation Changed
Starting with Node.js 27, if --max-old-space-size is not explicitly set, the default heap limit equals half of the system's physical memory, clamped between 256 MB and 4 GB. For example:
4 GB machine → 2 GB limit
2 GB machine → 1 GB limit
64 GB server → 4 GB limit (capped)
The intent is to prevent Node from consuming all memory on small machines and from growing unbounded on large ones. The trade‑off is that deployments that never set this flag will see their usable heap capacity change silently.
Official migration advice: applications that relied on the old default should explicitly set --max-old-space-size. To verify the active limit at runtime, print v8.getHeapStatistics().heap_size_limit (value in bytes).
# Don't rely on the default value
node --max-old-space-size=4096 server.jsBuffer Memory Now Counted in Heap
More critically, Buffer and ArrayBuffer instance memory is now included in the heap limit. Previously, a service holding 500 MB of JavaScript objects and 3 GB of Buffer data would only report ~500 MB heapUsed; the 3 GB was off‑heap and invisible to monitoring. After upgrading to Node.js 27, that 3 GB counts toward the heap limit, so the same service may immediately hit the ceiling and throw JavaScript heap out of memory.
Workloads that process files, transcode images, or buffer large logs are especially affected. The article recommends checking peak Buffer usage before upgrading.
Other Changes
V8 15.6 – enables Math.sumPrecise(), Iterator.zip(), Iterator.prototype.join() and three other features by default; import defer and immutable ArrayBuffer still require flags.
npm 12.1.0 bundled.
fs.glob – rewritten as a core built‑in, no longer depends on the external glob package; bulk file matching in large repositories is faster.
http.keepAliveTimeout default raised from 5 seconds to 65 seconds. Longer connection reuse increases idle‑connection resource usage; if a front‑end load balancer uses a 60‑second timeout, the backend may still be waiting on a connection the front end has already closed.
Node.js 27 is currently in alpha; the stable release is expected around April next year.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
JavaScript
Provides JavaScript enthusiasts with tutorials and experience sharing on web front‑end technologies, including JavaScript, Node.js, Deno, Vue.js, React, Angular, HTML5, CSS3, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
