{"id":16152646,"url":"https://github.com/simonsiefke/vscode-memory-leak-finder","last_synced_at":"2026-05-11T23:04:04.368Z","repository":{"id":178124683,"uuid":"482747353","full_name":"SimonSiefke/vscode-memory-leak-finder","owner":"SimonSiefke","description":"Find memory leaks in vscode","archived":false,"fork":false,"pushed_at":"2026-01-28T20:34:10.000Z","size":20256,"stargazers_count":13,"open_issues_count":7,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-29T09:26:24.514Z","etag":null,"topics":["memory-leak","vscode"],"latest_commit_sha":null,"homepage":"https://simonsiefke.github.io/vscode-memory-leak-finder/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SimonSiefke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-18T06:58:27.000Z","updated_at":"2026-01-28T19:13:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"293860dd-5315-4675-9b39-1fc33c2e05ea","html_url":"https://github.com/SimonSiefke/vscode-memory-leak-finder","commit_stats":{"total_commits":1404,"total_committers":2,"mean_commits":702.0,"dds":0.002849002849002802,"last_synced_commit":"9dfebf081193178354255d3f0e4528d407020b09"},"previous_names":["simonsiefke/vscode-memory-leak-finder"],"tags_count":226,"template":false,"template_full_name":null,"purl":"pkg:github/SimonSiefke/vscode-memory-leak-finder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonSiefke%2Fvscode-memory-leak-finder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonSiefke%2Fvscode-memory-leak-finder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonSiefke%2Fvscode-memory-leak-finder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonSiefke%2Fvscode-memory-leak-finder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SimonSiefke","download_url":"https://codeload.github.com/SimonSiefke/vscode-memory-leak-finder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonSiefke%2Fvscode-memory-leak-finder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28939508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T10:18:23.202Z","status":"ssl_error","status_checked_at":"2026-01-31T10:18:22.693Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["memory-leak","vscode"],"created_at":"2024-10-10T01:08:31.409Z","updated_at":"2026-01-31T11:03:18.451Z","avatar_url":"https://github.com/SimonSiefke.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VSCode Memory Leak Finder\n\nFind memory leaks in vscode to improve robustness and performance.\n\n## Quickstart\n\n```sh\ngit clone git@github.com:SimonSiefke/vscode-memory-leak-finder.git \u0026\u0026\ncd vscode-memory-leak-finder \u0026\u0026\nnpm ci \u0026\u0026\nnpm run e2e\n```\n\n## Measures\n\n### ArrayCount\n\nMeasures the total number of arrays.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure array-count --only base\n```\n\n### ArrayElementCount\n\nMeasures the total number of elements in all arrays.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure array-element-count --only base\n```\n\n### ClassCount\n\nMeasures the total number of classes.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure class-count --only base\n```\n\n### DetachedDomNodeCount\n\nMeasures the total number of detached dom nodes.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure detached-dom-node-count --only base\n```\n\n### DomCounters\n\nMeasures dom nodes, jsEventListeners and documents.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure dom-counters --only base\n```\n\n### DomNodeCount\n\nMeasures the total number of dom nodes.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure dom-node-count --only base\n```\n\n### EditContextCount\n\nMeasures the total number of edit context.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure edit-context-count --only base\n```\n\n### EventListenerCount\n\nMeasures the total number of event listeners.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure event-listener-count --only base\n```\n\n### EventListeners\n\nMeasures the event listeners.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure event-listeners --only base\n```\n\n### FunctionCount\n\nMeasures the total number of functions.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure function-count --only base\n```\n\n### GlobalLexicalScopeNames\n\nMeasures global variables / global lexical scope names.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure global-lexical-scope-names --only base\n```\n\n### HeapUsage\n\nMeasures heap usage.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure heap-usage --only base\n```\n\n### InstanceCounts\n\nMeasures the number of instances of each class.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure instance-counts --only base\n```\n\n### IntersectionObserverCount\n\nMeasures the number of intersection observers.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure intersection-observer-count --only base\n```\n\n### MapSize\n\nMeasures the total number of elements in all Maps.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure map-size --only base\n```\n\n### MediaQueryListCount\n\nMeasures the total number of MediaQueryLists.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure media-query-list-count --only base\n```\n\n### MutationObserverCount\n\nMeasures the total number of MutationObservers.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure mutation-observer-count --only base\n```\n\n### NamedFunctionCount\n\nMeasures the count of each function.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure named-function-count --only base\n```\n\n### NamedFunctionDifference\n\nMeasures the difference in counts of each function.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure named-function-difference --only base\n```\n\n### PromiseCount\n\nMeasures the total number of Promises.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure promise-count --only base\n```\n\n### RegexCount\n\nMeasures the total number of Regex instances.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure regex-count --only base\n```\n\n### ResizeObserverCount\n\nMeasures the total number of ResizeObservers.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure resize-observer-count --only base\n```\n\n### SetSize\n\nMeasures the total number of elements in all Sets.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure set-size --only base\n```\n\n### SetTimeout\n\nMeasures the total number of Timeouts.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure set-timeout --only base\n```\n\n### WeakMapCount\n\nMeasures the total number of WeakMaps.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure weak-map-count --only base\n```\n\n### WeakSetCount\n\nMeasures the total number of WeakSets.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure weak-set-count --only base\n```\n\n### WindowCount\n\nMeasures the total number of Windows.\n\n```sh\nnode packages/cli/bin/test.js --cwd packages/e2e  --check-leaks --measure-after --measure window-count --only base\n```\n\n## Project Structure\n\n- packages/charts: Visualizations for test output\n- packages/cli: Command Line Interface, similar to jest\n- packages/devtools-protocol: Functionality related to Chrome Devtools Protocol\n- packages/e2e: The e2e test scenarios\n- packages/file-watcher-worker: Watch files for changes\n- packages/injected-code: Code injected to the page for e2e tests\n- packages/memory-leak-finder: Library for finding memory leaks\n- packages/memory-leak-worker: Process for finding memory leaks (uses the library from above)\n- packages/page-object: Page Object Model to simplify e2e tests\n- packages/source-map-worker: Functions for querying original positions and function names using source maps\n- packages/test-coordinator: Determines which tests to run, launches VSCode, file-watcher-worker, test-worker, memory-leak-worker, video-recording-worker\n- packages/test-worker: Runs tests\n- packages/test-worker-commands: Functions used by test-worker\n- packages/video-recording-worker: Record screencasts of the tests\n\n## How does it work\n\nBefore and after a test is executed, all event listeners are queried using Chrome Devtools Protocol `Runtime.queryObjects({ prototypeId: \"EventTarget.prototype\" })` and `DomDebugger.getEventListeners`.\n\nWe get an array of event listeners `before` and `after`, for example\n\n```jsonc\n// before\n[\n  {\n    \"type\": \"focusin\",\n    \"description\": \"()=\u003ethis.j()\",\n    \"objectId\": \"524841679309534768.4.2930\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:148:37007)\",\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\",\n    ],\n  },\n]\n```\n\nand\n\n```jsonc\n// after\n[\n  {\n    \"type\": \"focusin\",\n    \"description\": \"()=\u003ethis.j()\",\n    \"objectId\": \"524841679309534768.4.2930\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:148:37007)\",\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\",\n    ],\n  },\n  {\n    \"type\": \"keydown\",\n    \"description\": \"N=\u003e{new P.$qO(N).equals(2)\u0026\u0026N.preventDefault()}\",\n    \"objectId\": \"3680313440875909344.4.4572\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:39878)\",\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\",\n    ],\n    \"originalStack\": [\"/src/vs/base/browser/ui/menu/menu.ts:122:58\"],\n  },\n]\n```\n\nThe `before` and `after` arrays are compared to see which event listeners have been added. In the example above, there is one keydown listener more in the `after` array which is not in the `before` array.\n\nThe tests are structured in a way one would be expect that the number of event listeners before and after the test are equal. For example, when opening and closing the menu, one would expect the number of event listeners stays equal. This is the menu toggle test:\n\n```js\n// title-bar-menu-toggle.js\nexport const run = async ({ TitleBar }) =\u003e {\n  await TitleBar.showMenuFile()\n  await TitleBar.hideMenuFile()\n}\n```\n\nEvery time the test was executed, event listeners increased by one keydown listener in `/src/vs/base/browser/ui/menu/menu.ts:122:58`, which indicates a memory leak and in this case was precisely the location of the memory leak.\n\nIn other cases, the output for memory leaks might not be quite as clear, but maybe still helpful. This is the output for the notebook-open test (opening and closing a notebook):\n\n```json\n[\n  {\n    \"type\": \"contextmenu\",\n    \"description\": \"n=\u003e{t.$_O.stop(n,!0)}\",\n    \"objectId\": \"2723967474668247540.4.13637\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:18357)\"\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\"\n    ],\n    \"count\": 1,\n    \"originalStack\": [\"/src/vs/base/browser/ui/actionbar/actionbar.ts:370:117\"]\n  },\n  {\n    \"type\": \"-monaco-gesturetap\",\n    \"description\": \"r=\u003ethis.onClick(r,!0)\",\n    \"objectId\": \"2723967474668247540.4.13695\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:10198)\"\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\"\n    ],\n    \"count\": 1,\n    \"originalStack\": [\"/src/vs/base/browser/ui/actionbar/actionViewItems.ts:121:68\"]\n  },\n  {\n    \"type\": \"mousedown\",\n    \"description\": \"r=\u003e{c||I.$_O.stop(r,!0),this._action.enabled\u0026\u0026r.button===0\u0026\u0026o.classList.add(\\\"active\\\")}\",\n    \"objectId\": \"2723967474668247540.4.13697\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:10258)\"\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\"\n    ],\n    \"count\": 1,\n    \"originalStack\": [\"/src/vs/base/browser/ui/actionbar/actionViewItems.ts:123:70\"]\n  },\n  {\n    \"type\": \"click\",\n    \"description\": \"r=\u003e{I.$_O.stop(r,!0),this.m\u0026\u0026this.m.isMenu||this.onClick(r)}\",\n    \"objectId\": \"2723967474668247540.4.13699\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:10475)\"\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\"\n    ],\n    \"count\": 1,\n    \"originalStack\": [\"/src/vs/base/browser/ui/actionbar/actionViewItems.ts:145:65\"]\n  },\n  {\n    \"type\": \"dblclick\",\n    \"description\": \"r=\u003e{I.$_O.stop(r,!0)}\",\n    \"objectId\": \"2723967474668247540.4.13701\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:10572)\"\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\"\n    ],\n    \"count\": 1,\n    \"originalStack\": [\"/src/vs/base/browser/ui/actionbar/actionViewItems.ts:154:68\"]\n  },\n  {\n    \"type\": \"mouseout\",\n    \"description\": \"n=\u003e{I.$_O.stop(n),o.classList.remove(\\\"active\\\")}\",\n    \"objectId\": \"2723967474668247540.4.13705\",\n    \"stack\": [\n      \"listener (file:///home/simon/.cache/repos/vscode-memory-leak-finder/.vscode-test/vscode-linux-x64-1.83.1/resources/app/out/vs/workbench/workbench.desktop.main.js:244:10662)\"\n    ],\n    \"sourceMaps\": [\n      \"https://ticino.blob.core.windows.net/sourcemaps/f1b07bd25dfad64b0167beb15359ae573aecd2cc/core/vs/workbench/workbench.desktop.main.js.map\"\n    ],\n    \"count\": 2,\n    \"originalStack\": [\"/src/vs/base/browser/ui/actionbar/actionViewItems.ts:159:56\"]\n  }\n]\n```\n\nIt seems there is memory leak when opening and closing a notebook. But just looking at the output, it's difficult to say much more. It's not clear where exactly the memory leak is and one might need to look more closely at the `actionbar.ts` and `actionViewItems.ts` code.\n\n## Memory Leaks\n\n| Component            | Issue                                             | Status |\n| -------------------- | ------------------------------------------------- | ------ |\n| Menu                 | https://github.com/microsoft/vscode/issues/195580 | Fixed  |\n| Dropdown             | https://github.com/microsoft/vscode/issues/197767 | Fixed  |\n| MenuBar              | https://github.com/microsoft/vscode/issues/198051 | Fixed  |\n| DefaultWorkerFactory | https://github.com/microsoft/vscode/issues/198709 | Fixed  |\n| ExtensionList        | https://github.com/microsoft/vscode/issues/198709 | Fixed  |\n| SimpleFindWidget     | https://github.com/microsoft/vscode/issues/199043 | Fixed  |\n| ColorPickerWidget    | https://github.com/microsoft/vscode/issues/199814 | Fixed  |\n| DiffEditor           | https://github.com/microsoft/vscode/issues/200381 | Fixed  |\n| QuickPick            | https://github.com/microsoft/vscode/issues/201320 | Fixed  |\n| Terminal             | https://github.com/xtermjs/xterm.js/issues/4935   | Fixed  |\n| KeyBindingsEditor    | https://github.com/microsoft/vscode/issues/202455 | Fixed  |\n| NotebookEditorWidget | https://github.com/microsoft/vscode/issues/204756 | Fixed  |\n| SettingsEditor2      | https://github.com/microsoft/vscode/pull/216763   | Fixed  |\n| SettingEnumRenderer  | https://github.com/microsoft/vscode/pull/216855   | Fixed  |\n| GettingStarted       | https://github.com/microsoft/vscode/issues/216858 | Fixed  |\n| ExtensionTabs        | https://github.com/microsoft/vscode/pull/219726   | Fixed  |\n| Output               | https://github.com/microsoft/vscode/pull/221605   | Fixed  |\n| StickyScroll         | https://github.com/microsoft/vscode/pull/221622   | Fixed  |\n| SelectBox            | https://github.com/microsoft/vscode/pull/221507   | Fixed  |\n| DebugView            | https://github.com/microsoft/vscode/pull/225334   | Fixed  |\n| SettingsIndicators   | https://github.com/microsoft/vscode/pull/236417   | Fixed  |\n\n## Credits\n\nThis project is based on the [jest cli](https://github.com/jestjs/jest), [playwright](https://github.com/microsoft/playwright/) and [fuite](https://github.com/nolanlawson/fuite).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsiefke%2Fvscode-memory-leak-finder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonsiefke%2Fvscode-memory-leak-finder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsiefke%2Fvscode-memory-leak-finder/lists"}