{
  "slug": "analyze-heapsnapshot-contexts-finds-closure-contexts-retaining-dead-fields-66aa0a5514fe",
  "title": "analyze_heapsnapshot_contexts finds closure contexts retaining dead fields",
  "tools": [
    "chrome-devtools-mcp"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-10-15T14:01:41.000Z",
  "announced_at": "2026-10-15T14:01:41.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When diagnosing retained memory from a heap snapshot, use `analyze_heapsnapshot_contexts` to rank closure contexts holding dead captured fields; it requires `--memoryDebugging=true`. The retained-size score is a prioritizing heuristic, not an exact measure of reclaimable bytes.",
    "examples": [
      "analyze_heapsnapshot_contexts({\"filePath\":\"<path-to-file.heapsnapshot>\"})",
      "analyze_heapsnapshot_contexts({\"filePath\":\"<path-to-file.heapsnapshot>\",\"pageIdx\":0,\"pageSize\":20,\"retainedSize\":\"1MB-2MB\"})",
      "analyze_heapsnapshot_contexts({\"filePath\":\"<path-to-file.heapsnapshot>\",\"scopeInfoNodeId\":<scope-info-node-id>})"
    ],
    "gotchas": [
      "Version: 1.11.0",
      "filePath (required): Path to a `.heapsnapshot` file to read.",
      "pageIdx: Zero-based page index; defaults to 0.",
      "pageSize: Contexts returned per page; defaults to 20.",
      "retainedSize: Inclusive range for the dead-field score (for example, `10KB`, `1MB-2MB`, `-1MB`, or `1MB-`); one value is treated as a minimum.",
      "scopeInfoNodeId: Limit results to contexts declared by this ScopeInfo node ID, as reported in a previous call.",
      "--memoryDebugging=true (required): Required server flag to enable this tool.",
      "Prerequisite: Enable the MCP server flag `--memoryDebugging=true`.",
      "Requires `--memoryDebugging=true`.",
      "`filePath` must identify a `.heapsnapshot` file.",
      "`pageIdx` defaults to 0; `pageSize` defaults to 20.",
      "The retained-size score is a prioritizing heuristic, not an exact measure of reclaimable bytes."
    ]
  },
  "why_it_matters": "When diagnosing retained memory from a heap snapshot, identify closure contexts holding dead captured variables.",
  "sources": [
    "https://github.com/ChromeDevTools/chrome-devtools-mcp/releases/tag/chrome-devtools-mcp-v1.11.0",
    "https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/2791",
    "https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/190aeee80f91f2a9797b8e686e3cfefc436bf0e0/docs/tool-reference.md"
  ],
  "rank": 0.98015,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "daily-20261015-20",
    "verdict_id": "daily-20261015-20:daily-20261015-20-0fad988eee015972-1:gate",
    "evidence_hash": "f4ab448bcf93bfbc244c11495c3319bca957c64c1a6b2148d3c22048468b33a0"
  },
  "review": {
    "draft_hash": "65b3c41f17a5acde7e36ad331c36d527e5f82acac57056aa72c33230a3f92915",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-15T14:01:41.000Z",
    "decision": "daily-20261015-20:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.79 (>= 0.6 needed)."
  }
}
