Repository navigation
Commit f6fe81c
committed
Fixed heap not being released after load on Node 24+
ref https://issues.chromium.org/issues/570738027
ref nodejs/node#66564
V8 13+ (Node 24 and 26) decides whether to run its memory reducer from the
young, old and embedder (cppgc) allocation rates. Ghost never allocates on
the cppgc heap, so the embedder rate is exactly zero, which V8 treats as the
lowest possible mutator utilisation, i.e. "high allocation". The reducer
therefore never runs after a burst of traffic and post-load heap is only
released by its 100s watchdog, or not at all while full GCs keep resetting it.
On the Ghost(Pro) performance benchmark, Node 24 held 519MB RSS 60s after
load versus 202MB on Node 22, with the same live heap. vm.Script is
cppgc-backed in Node 24+, so allocating one at boot and every 30s keeps the
embedder rate non-zero; with that, Node 24 settled at 205MB with no change in
load CPU or latency. This avoids forced GCs (188-270ms pauses on the same
benchmark) and V8 flag changes such as --memory-saver-mode (60-75% more CPU
under load).
It only runs on V8 13+, so Node 22 is unaffected, and should be removed once
the upstream V8 fix reaches our supported Node versions.1 parent 82d2b08 commit f6fe81c
2 files changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
680 | 684 | | |
681 | 685 | | |
682 | 686 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments