
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
node-oom-heapdump
Advanced tools
Node module which will create a V8 memory snapshot right before an "Out of Memory" error occurs.
Node module which will create a V8 memory snapshot right before an "Out of Memory" error occurs.
Node 8+ required.
When running nodejs processes in a low memory environment, every out of memory that occurs is interesting. To figure out why a process went out of memory, a memory snapshot (e.g. heapdump) can help a lot. This module creates a memory snapshot right before an suspected out of memory error occurs. It shows what the heap was filled with right before the out of memory error occured.
There are several modules around which can create heapdumps (v8-profiler, node-heapdump), but these run in the same process as the one going out of memory. Often, creating heapdump won't work when the node process is already struggling. This module creates the memory snapshot from a separate process, which solves this issue.
It uses 'gc-stats' to determine when an out of memory error is about to occur and then fires up a new process which uses 'chrome-remote-interface' to connect with the DevTools protocol (https://chromedevtools.github.io/devtools-protocol/v8/) of the calling process. That process uses HeapProfiler to actually create the heapdump and then exits.
Just run "npm test" to see it in action. It creates a heapdump named "my_snapshot.heapsnapshot" in the root.
npm install node-oom-heapdump
Just add the following snippet to your node process.
require("node-oom-heapdump")({
threshold: 75,
name: "my_heapdump"
});
Your node process should at least be started with the "--inspect" (or --inspect=port) flag. When running in a low memory environment, the following flags are advised:
These might impact performance though.
FAQs
Create a V8 heap snapshot when an "Out of Memory" error occurs, or create a heap snapshot or CPU profile on request.
The npm package node-oom-heapdump receives a total of 0 weekly downloads. As such, node-oom-heapdump popularity was classified as not popular.
We found that node-oom-heapdump demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.