跳到正文
cccskills
免费在 GitHub 公开中文介绍

memory-leak-debugging

排查 JavaScript 或 Node.js 应用内存持续增长和内存溢出错误。使用 Chrome DevTools MCP 内存工具获取并比较堆快照、追踪被保留的对象,找出可能的泄漏来源,为后续修复提供线索。

原文查看原文说明

Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to capture, compare, or inspect heap snapshots with Chrome DevTools MCP memory tools.

asgeirtj/system_prompts_leaks星标 70,411(GitHub 70,411 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 排查网页应用内存不断增长
  • 调查 Node.js 内存溢出错误
  • 比较操作前后的堆快照
  • 追踪未移除的监听器或闭包

中文介绍

功能

此技能帮助你调查 JavaScript 或 Node.js 应用内存使用量持续增长的原因,并整理可用于修复的线索。借助 Chrome DevTools MCP 内存工具,可以获取和比较堆快照,查看哪些对象类型有所增加,并追踪仍然引用这些对象的路径。工作流程会区分浏览器端和 Node.js 端的问题,并检查已脱离文档的 DOM 元素、未移除的事件监听器、闭包以及持续增长的缓存。调查结束后,它会关闭已加载的快照,以释放 MCP 服务器占用的内存。

适用场景

应用占用内存较高、反复操作后变慢,或出现内存溢出错误时,可以用它排查问题。需要比较操作前后的堆快照,并确认哪些对象仍被保留时,也适用。

使用示例

  • “请调查反复操作这个页面后内存持续增长的原因。”
  • “请比较堆快照,找出数量增加的对象。”
  • “请排查这个 Node.js 内存溢出错误的原因。”

注意事项

使用详细的快照比较工具,需要以 --memoryDebugging 标志启动 Chrome DevTools MCP 服务器。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好资料要求清理脱离文档的 DOM 节点前询问用户,并在结束后关闭快照。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要 Chrome DevTools MCP;高级工具还要求启动标志。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月30日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(2)

  • SKILL.md4.2 KB
  • references/common-leaks.md1.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Memory Leak Debugging

This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications using Chrome DevTools MCP tools.

Prerequisites

Advanced memory debugging tools (compare_heapsnapshots, get_heapsnapshot_details, etc.) are only available when the server is started with the --memoryDebugging flag. First check if these tools are available; if not, try to read the MCP configuration file to check if --memoryDebugging is enabled.

Core Principles

  • Prefer MCP memory tools: Do NOT attempt to read raw .heapsnapshot files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.
  • Isolate the Leak: Determine if the leak is in the browser (client-side) or Node.js (server-side).
  • Common Culprits: Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing unbounded. Note: Detached DOM nodes are sometimes intentional caches; always ask the user before nulling them.
  • Close Loaded Snapshots: Heap snapshots can be large. After completing an investigation, use close_heapsnapshot for each loaded snapshot to release memory held by the MCP server.

Workflows

1. Capturing Snapshots

When investigating a frontend web application memory leak, utilize the chrome-devtools-mcp tools to interact with the application and take snapshots.

  • Use page-scoped tools like click, navigate_page, fill, etc. (specifying pageId) to manipulate the page into the desired state.
  • Revert the page back to the original state after interactions to see if memory is released.
  • Repeat the same user interactions 10 times to amplify the leak.
  • Use take_heapsnapshot (with pageId) to save .heapsnapshot files to disk at baseline, target (after actions), and final (after reverting actions) states.

2. Comparing Snapshots

Once you have generated .heapsnapshot files using take_heapsnapshot, compare them with Chrome DevTools MCP memory tools.

  • Start with get_heapsnapshot_summary for each snapshot to confirm that the files load and to compare high-level totals.
  • Use compare_heapsnapshots to compare baseline and target snapshots. Start without classIndex for the summary diff, then request detailed class diffs only for suspicious growth by specifying classIndex.
  • Use the summary output from compare_heapsnapshots before drilling into specific node IDs.

3. Inspecting Retainers and Dominator Chains

When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.

  • Use get_heapsnapshot_class_nodes to list instances of the suspicious class.
  • Use get_heapsnapshot_retainers, get_heapsnapshot_retaining_paths, get_heapsnapshot_dominators, and get_heapsnapshot_edges to understand why representative nodes are still reachable.
  • Use get_heapsnapshot_object_details with a specific nodeId to retrieve detailed object metadata (size, type, distance, and DOM detachedness).
  • Use get_heapsnapshot_duplicate_strings when string growth dominates the diff.
  • Read references/common-leaks.md for examples of common memory leaks and how to fix them after the retaining path points at application code.

4. Advanced Analysis and Categorized Filters

Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.

  • Use get_heapsnapshot_details or get_heapsnapshot_class_nodes with filterName to target common leak causes:
    • objectsRetainedByDetachedDomNodes: Identifies detached DOM elements retained in memory.
    • objectsRetainedByEventHandlers: Identifies objects kept alive by unremoved event listeners.
    • objectsRetainedByContexts: Identifies objects trapped in closures or execution contexts.
    • objectsRetainedByConsole: Identifies objects retained by console logging.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

3d-object

免费有简介

使用three.js创建立体模型,在交互式查看器中从各个角度检查形状和材质,并以OBJ + MTL或GLB格式保存,供其他三维制作软件使用。

  • 创建立体模型并从各个角度检查
  • 制作可在Blender中继续编辑的模型
  • 检查模型轮廓和材质效果
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

Audit web accessibility with Chrome DevTools MCP and Lighthouse. Inspect semantic structure, labels, keyboard focus, tap target size, and color contrast, then identify page elements that may need changes based on web.dev guidance.

中文简介正在准备中。当前显示英语简介。

  • Finding missing labels or image alternatives
  • Checking heading structure and reading order
  • Testing keyboard navigation and modal focus
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

action-items

免费有简介

在个人任务清单中记录待办事项、承诺、期限、下一步、待回复对象和阻碍原因,更新进度与依赖关系,合并重复项并归档已结束的任务。

  • 记录有期限的任务与承诺
  • 整理待回复事项及阻碍原因
  • 前置任务完成后更新依赖关系
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

agents

免费

Coordinate a task from a verifiable goal through completion. Handle work directly or split independent tasks across separate agent sessions, track progress, verify results, and arrange pull request merging when included in the goal.

中文简介正在准备中。当前显示英语简介。

  • Split independent tasks across agents
  • Check progress across ongoing tasks
  • Resume a previously started project
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

agy-customizations

免费有简介

了解 Antigravity 如何发现和加载自定义配置,包括配置位置与优先级。借助本指南选择并创建技能、规则、插件、钩子或 MCP 服务器,用于智能体工作流程和外部工具连接。

  • 选择合适的自定义配置类型
  • 查看配置的发现位置和加载顺序
  • 创建技能或规则
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

animated-video

免费有简介

将动画制作成可播放、暂停和定位时间的HTML页面,通过时间轴调整场景时长与速度,并为横屏或竖屏视频导出做好准备。

  • 制作产品操作演示动画
  • 用文字和图形解释内容
  • 制作竖屏动画
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

查看 asgeirtj 的全部技能

报告此技能的问题