heap_snapshot
Capture a JavaScript heap snapshot after garbage collection to summarize memory use, detached DOM nodes, and top classes; compare with an earlier snapshot to spot leaks.
Instructions
Take a JS heap snapshot of the tab (after a garbage collection) and summarize it: object count, total size, detached DOM nodes, the classes that take most memory. With compare_to (an earlier snapshot file): which classes grew, to find a leak — snapshot, repeat the suspect action a few times, snapshot again. The .heapsnapshot file opens in DevTools > Memory. Works only in launch mode (chrome-bridge --launch [--headless]): it needs the DevTools port of the dedicated browser, which the extension in your own Chrome cannot provide: Chrome refuses the HeapProfiler domain to extensions.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "heap_snapshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | Classes listed | |
| tab_id | No | Target tab; omitted = last tab navigated in this session, else the active one | |
| save_to | No | Absolute path: write the .heapsnapshot there and return the path instead of the content | |
| compare_to | No | Absolute path of an earlier .heapsnapshot to diff against |