Skip to content

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)

ToolDescription
v8_heap_snapshot_captureCapture a V8 heap snapshot for offline analysis.
v8_heap_snapshot_analyzeAnalyze a heap snapshot: class histogram (object count/sizes by constructor), statistics (total objects, detached DOM nodes), optional dominator tree, and leak detection.
v8_heap_diffCompare two heap snapshots to find allocation changes.
v8_object_inspectInspect a live JS object by objectId with property enumeration.
v8_heap_statsReport V8 heap statistics: used, total, external.
v8_bytecode_extractExtract V8 bytecode for a script by scriptId, with source fallback.
v8_version_detectDetect V8 engine version, flags, and runtime capabilities.
v8_jit_inspectReport JIT compilation status and optimization tier for a script.
v8_heap_find_leaksFind 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_retainersTrace 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_traceTrace 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_inspectInspect 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_graphCollect 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_retainedFind 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_compareCompare 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_inspectInspect 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.

Released under AGPL-3.0-only