V8 Inspector
Domain: v8-inspector
V8 inspector domain providing heap snapshot analysis, CPU profiling, and memory inspection.
Profiles
- workflow
- full
Typical scenarios
- Heap snapshot analysis
- CPU profiling
- Memory leak detection
Common combinations
- v8-inspector + browser
- v8-inspector + debugger
Full tool list (16)
| Tool | Description |
|---|---|
v8_heap_snapshot_capture | Capture a V8 heap snapshot for offline analysis. |
v8_heap_snapshot_analyze | Analyze a heap snapshot: class histogram (object count/sizes by constructor), statistics (total objects, detached DOM nodes), optional dominator tree, and leak detection. |
v8_heap_diff | Compare two heap snapshots to find allocation changes. |
v8_object_inspect | Inspect a live JS object by objectId with property enumeration. |
v8_heap_stats | Report V8 heap statistics: used, total, external. |
v8_bytecode_extract | Extract V8 bytecode for a script by scriptId, with source fallback. |
v8_version_detect | Detect V8 engine version, flags, and runtime capabilities. |
v8_jit_inspect | Report JIT compilation status and optimization tier for a script. |
v8_heap_find_leaks | Find suspected memory leaks in a heap snapshot. Returns leak candidates sorted by confidence, including detached DOM nodes, large arrays, closure leaks, and unexpectedly large retained objects. |
v8_heap_retainers | Trace retainer chains from suspect leak objects back to GC roots. For each nodeId, walks the immediate-dominator chain to produce a "what keeps it alive" path: leaf → ... → GC root. Each step includes nodeId, name, className, shallowSize, retainedSize, and distance from the leaf. Use after v8_heap_find_leaks or v8_heap_snapshot_analyze to understand why a specific object is not being collected. |
v8_deopt_trace | Trace V8 deoptimization events during a capture window. Enables %TraceDeoptimizations via natives syntax and captures deopt events (function name, reason, bailout position). Requires V8 natives syntax. Falls back gracefully when unavailable. |
v8_turbofan_inspect | Inspect TurboFan compilation state for functions in a script. Reports optimization tier (interpreted/maglev/turbofan). Supports actions: inspect (default), optimize (%OptimizeFunctionOnNextCall), deoptimize (%DeoptimizeFunction). Requires V8 natives syntax. |
v8_turbofan_graph | Collect and visualize V8 TurboFan IR (sea-of-nodes / Turboshaft graph). Two modes: (1) Provide JS source code — spawns an isolated V8 child with --trace-turbo to generate IR JSON, then parses nodes, edges, phases, and opcode histogram. (2) Provide a traceDir path to read already-generated turbo-*.json files (e.g. from a browser launched with --trace-turbo). Returns per-function graph summaries with phase-level node/edge counts, sample nodes, and opcode distribution. |
v8_function_retained | Find all heap objects retained by functions matching a name pattern. Walks the dominator tree to find objects whose constructor/class name matches the given pattern, then returns each with its retainer chain. Useful for understanding which objects a specific function/class is holding alive. |
v8_object_compare | Compare heap objects by shallow/retained size, class name, and property count. Same-snapshot mode (objectIds only) does all-pairs comparison (n-choose-2). Cross-snapshot mode (anotherSnapshotId + anotherObjectIds) does pairwise A[i]↔B[i] comparison. Use to track object growth over time, find memory regression candidates, or compare leaked vs healthy objects of the same class. |
v8_wasm_inspect | Inspect WebAssembly modules and garbage-collected WASM objects in the page. Discovers .wasm script resources via performance.getEntriesByType, detects WASM GC (struct/array/ref-types) availability, and enumerates feature flags (gc/threads/simd). Supports optional scriptId filter to inspect a specific WASM module. Requires browser/page CDP context. Note: structural type enumeration (includeStructs) requires Chrome ≥ M119 with --enable-features=WebAssemblyGC; absent that, returns gcAvailable flag and script-level summary only. |