Memory Leak Audit
Systematically find and fix listener, lifecycle, and disposable leaks in VS Code code.
The skill provides code-review guidance only and requests no credentials, network access, or elevated privileges. Its recommendations generally promote disposal and lifecycle isolation. It does not specify user confirmation, sensitive-data handling, rollback, or external-side-effect boundaries, and the cited PR claims are not directly verified in the supplied material, so points are deducted.
The six-step checklist, examples, and verification section are internally readable, and the repository shows related chat leak scripts and CI workflows. However, the skill does not define handling for abnormal input, ambiguous framework semantics, failed tests, or unavailable dependencies; several rules are absolute, and key paths were not statically reproducible, so the score remains below the static ceiling.
Trigger scenarios are clear and cover listeners, lifecycle events, repeated calls, pooled objects, and tests. Non-fit cases, input/output format, audit boundaries, and semantic exceptions are not clearly defined. Chinese-language support is absent, but the core function does not depend entirely on unreachable overseas services, so only partial points are deducted.
The document has useful progressive structure with usage conditions, ordered checks, examples, and a quick-reference table. Repository context supplies MIT licensing, version information, and official maintenance provenance. The skill lacks installation or dependency notes, named ownership, an update path, changelog, FAQ, and explicit known limitations, warranting a mid-level score.
The guidance can directly help a reviewer identify common disposable leaks and suggests concrete repair patterns such as MutableDisposable, Event.once, and DisposableStore. Repository context also exposes a chat memory-leak script and CI entry point. The skill does not define a standard review output or patch format, requires case-specific judgment, and has no statically verified representative outputs, so points are deducted.
The skill names PRs, code patterns, and repository scripts, while the supplied workflow provides auditable CI definitions for chat memory-leak checks. It lacks committed tests mapped to the skill's six key paths, pinned supporting evidence, and independent reproduction; no execution was performed in this review, so verifiability is limited.
- Do not apply the absolute rules mechanically; verify object lifetime, event semantics, and ownership in the local context.
- The cited PR validation claims were not independently verified from the supplied material and should not be treated as proven test results.
- Listener-count checks and the chat leak script require the repository's actual environment, dependencies, and build conditions; static review is not execution.
- The skill does not define an output format, failure diagnosis, or rollback procedure, leaving those responsibilities to the user.
What it does & when to use it
This skill supports VS Code code review and fixes for memory leaks, with emphasis on event listeners, DOM handlers, lifecycle callbacks, and disposable ownership. Its six-step checklist covers DOM events, one-time events, repeated method calls, model lifetimes, pooled resources, and test validation. It focuses on addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns. It is a good fit for leak-focused engineering work, although the source does not document a standalone installer or executable audit script.
It instructs an agent to inspect DOM event registration, one-time events, listeners created by repeatedly called methods, model-tied DisposableStores, disposal ownership for pooled objects, and disposable leak checks in test suites. It flags raw .onload, .onclick, addEventListener(), unsuitable this._register() usage, and missing model cleanup, then recommends the corresponding disposable patterns. After a fix, it can check listener counts before and after repeated operations, confirm that object counts stabilize, and, for chat-related leaks, run npm run perf:chat-leak --messages 20 --verbose.
- A developer reviews a search, toggle, or initialization method that may add another listener every time it runs.
- A developer investigates a reported DOM-handler or extension-icon leak where listener counts keep increasing.
- A developer implements onWillDispose or onDidClose lifecycle handling and needs resources to follow the model lifetime.
- A developer maintains list or tree pools and must scope each pooled item's listeners to that item rather than to the pool.
- A developer writes tests that create disposable objects and needs automatic suite-level leak validation.
Pros & cons
- Provides an ordered six-step checklist covering DOM events, one-time events, repeated calls, model lifetimes, pooled resources, and tests.
- Includes concrete bad-versus-good TypeScript examples.
- Names specific patterns: addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose.
- Defines post-fix checks for listener counts, object-count stabilization, and chat heap growth.
- The guidance is centered on VS Code-style disposables and event patterns; broader framework or runtime coverage is not evidenced.
- It provides no standalone audit script, test suite, or report format; the agent performs the review using the instructions.
- A standalone installation method is not documented.
- Chat leak verification depends on npm and the separately referenced chat-perf skill, whose contents are not included here.
How to install
The skill is located at .github/skills/memory-leak-audit/SKILL.md in the microsoft/vscode repository. The source only identifies it as one of 61 bundled skills and does not document a standalone installation command or package; load this SKILL.md in an Agent Skills-compatible client. The repository as a whole is licensed under MIT.
How to use
In a review or repair task, ask: "Audit this code for memory leaks and disposable issues, especially event listeners, DOM handlers, repeated calls, model lifecycle, and test cleanup." Have the agent follow the six-step checklist and verify that listener and object counts remain stable after repeated operations. For a chat-specific check, request npm run perf:chat-leak --messages 20 --verbose; the skill notes that this uses the chat-perf skill.