https://github.com/rocicorp/heap-snapshot
https://github.com/rocicorp/heap-snapshot
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/rocicorp/heap-snapshot
- Owner: rocicorp
- Created: 2025-06-03T17:27:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-03T17:50:14.000Z (about 1 year ago)
- Last Synced: 2025-06-04T03:14:38.398Z (about 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @rocicorp/heap-snapshot
It is often the case that we need to get a heap snapshot from running `zero-cache` processes.
Online guides and documentation suggest using the `chrome-remote-interface` package and then calling `v8.writeHeapSnapshot()`.
Doing this for `zero-cache` yields much smaller snapshots than those you get if you connect to the node process in Chrome's devtools and get a snapshot that way. These smaller snapshots lack many core classes of zero-cache such as `ViewSyncer`.
I do not understand why but ChatGPT suggests that the implementation of `v8.writeHeapSnapshot()` is different and simpler than the `HeapProfiler` class that Chrome itself uses, and misses some "uncommon" allocation patterns 😬.
This tool automates using the lower-level `HeapProfiler` class to create a dump that contains all of `zero-cache`'s objects.
## Usage
1. `kill -USR1 `
2. The targetted process prints out a message like: `Debugger listening on ws://127.0.0.1:9229/a8712980-d35d-434f-824c-db212b277b5e`
3. `npx @rocicorp/heap-snapshot `