--heapsnapshot-near-heap-limit
implementation (https://github.com/nodejs/node/pull/33010), it does work if I just write a snapshot to disk in that callback. I temporarily raise the heap size limit to a value slightly bigger than the original limit until the snapshot is done, and tells V8 to restore to the initial limit later. There are some observations with this approach:
#1
V8 provides v8::Isolate::AddNearHeapLimitCallback() for adjusting the heap limit when V8 is approaching it. The debugger implementation in V8 uses this to break at the point where the heap size limit is near in the Chrome DevTools. I did a proof of concept
--heapsnapshot-near-heap-limit
implementation (nodejs/node#33010), it does work if I just write a snapshot to disk in that callback. I temporarily raise the heap size limit to a value slightly bigger than the original limit until the snapshot is done, and tells V8 to restore to the initial limit later. There are some observations with this approach:test/fixtures/workload/allocation.js
and--max-old-space-size=100
, without using--heapsnapshot-near-heap-limit
, the process crashes in 20s after 73 GCs. With the option on it crashes in 121s after 130 GCs, leaving 12 snapshots of size 140-170MB on disks.Heap.20200423.063523.40985.0.001.heapsnapshot
,Heap.20200423.063524.40985.0.002.heapsnapshot
..)Any comments about these observations?
Originally posted by @joyeecheung in nodejs/node#27552 (comment)
The text was updated successfully, but these errors were encountered: