{"id":13511908,"url":"https://github.com/bnoordhuis/node-heapdump","last_synced_at":"2025-04-29T18:29:53.966Z","repository":{"id":4244590,"uuid":"5369562","full_name":"bnoordhuis/node-heapdump","owner":"bnoordhuis","description":"Make a dump of the V8 heap for later inspection.","archived":false,"fork":false,"pushed_at":"2022-04-08T11:07:00.000Z","size":83,"stargazers_count":2510,"open_issues_count":7,"forks_count":131,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-04-23T17:44:25.024Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnoordhuis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-10T13:28:33.000Z","updated_at":"2025-04-22T00:23:01.000Z","dependencies_parsed_at":"2022-08-02T02:20:07.868Z","dependency_job_id":null,"html_url":"https://github.com/bnoordhuis/node-heapdump","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnoordhuis%2Fnode-heapdump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnoordhuis%2Fnode-heapdump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnoordhuis%2Fnode-heapdump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnoordhuis%2Fnode-heapdump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnoordhuis","download_url":"https://codeload.github.com/bnoordhuis/node-heapdump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251559518,"owners_count":21609027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T03:01:18.282Z","updated_at":"2025-04-29T18:29:53.946Z","avatar_url":"https://github.com/bnoordhuis.png","language":"JavaScript","readme":"node-heapdump\n===\n\nMake a dump of the V8 heap for later inspection.\n\n### Install\n\n    npm install heapdump\n\n### Build\n\n    node-gyp configure build\n\n### Usage\n\nLoad the add-on in your application:\n\n    var heapdump = require('heapdump');\n\nThe module exports a single `writeSnapshot([filename], [callback])` function\nthat writes out a snapshot.  `filename` defaults to\n`heapdump-\u003csec\u003e.\u003cusec\u003e.heapsnapshot` when omitted.\n\n    heapdump.writeSnapshot('/var/local/' + Date.now() + '.heapsnapshot');\n\nThe function also takes an optional callback function which is called upon\ncompletion of the heap dump.\n\n    heapdump.writeSnapshot(function(err, filename) {\n      console.log('dump written to', filename);\n    });\n\nThe snapshot is written synchronously to disk.  When the JS heap is large,\nit may introduce a noticeable \"hitch\".\n\nOn UNIX platforms, you can force a snapshot by sending the node.js process\na SIGUSR2 signal:\n\n    $ kill -USR2 \u003cpid\u003e\n\nThe SIGUSR2 signal handler is enabled by default but you can disable it\nby setting `NODE_HEAPDUMP_OPTIONS=nosignal` in the environment:\n\n    $ env NODE_HEAPDUMP_OPTIONS=nosignal node script.js\n\nCatch the SIGUSR2 signal to write the snapshot to a custom location:\n\n```js\nif (!/nosignal/.test(process.env.NODE_HEAPDUMP_OPTIONS)) {\n  process.on(\"SIGUSR2\", function() {\n    heapdump.writeSnapshot('/var/local/' + Date.now() + '.heapsnapshot');\n  });\n}\n```\n\n### Inspecting the snapshot\n\nOpen [Google Chrome](https://www.google.com/intl/en/chrome/browser/) and\npress F12 to open the developer toolbar.\n\nGo to the `Memory` tab, right-click in the tab pane and select\n`Load profile...`.\n\nSelect the dump file and click `Open`.  You can now inspect the heap snapshot\nat your leisure. Some snapshots may take a long time to load, on the order of\nminutes or even hours.\n\nNote that Chrome will refuse to load the file unless it has the `.heapsnapshot`\nextension.\n\n### Caveats\n\nOn UNIX systems, the rule of thumb for creating a heap snapshot is that it\nrequires memory twice the size of the heap at the time of the snapshot.\nIf you end up with empty or truncated snapshot files, check the output of\n`dmesg`; you may have had a run-in with the system's OOM killer or a resource\nlimit enforcing policy, like `ulimit -u` (max user processes) or `ulimit -v`\n(max virtual memory size).\n","funding_links":[],"categories":["JavaScript","Repository"],"sub_categories":["Performance Profiling/Analysis"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnoordhuis%2Fnode-heapdump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnoordhuis%2Fnode-heapdump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnoordhuis%2Fnode-heapdump/lists"}