node-inspector / v8-profiler

node bindings for the v8 profiler
BSD 2-Clause "Simplified" License
1.13k stars 134 forks source link

Add "increaseHeapLimit" and "restoreHeapLimit" #118

Closed paulrutter closed 1 year ago

paulrutter commented 7 years ago

In order to be able to create a heapdump just before an out of memory occurs, it's necessary to increase the heap limit. Otherwise the heapdump cannot be created. See discussion (and code) in https://github.com/node-inspector/v8-profiler/issues/109.

These API calls are only available from Node8, so this pull request also incorporates this pull request .

I've updated the documentation and unit tests as well.

With this change i can monitor the (Full) GC's and when an out of memory seems imminent, the heap limit can be increased to allow for proper heapdump creation. For completeness the "restoreHeapLimit" function is also added.