microsoft / microsoft/PowerToys

Memory leak when activating extension via global hotkey

Open
#47,199 0 comments 1 reaction 2 assignees Claimed by @MuyuanMS View on GitHub
Area-Quality Issue-Bug Needs-Triage Product-Command Palette Severity-Medium
Dominant language
C
Stars
139k
Forks
8.6k
PR merge metrics
PR metrics pending

Description

### Microsoft PowerToys version

0.98.1

### Installation method

PowerToys auto-update

### Area(s) with issue?

Command Palette

### Steps to reproduce

1. Install Visual Studio / Code for Command Palette (latest version 1.26.0.0)
2. Configure a global hotkey
3. Trigger the extension using the global hotkey

### ✔️ Expected Behavior

Extension memory usage remains stable over time

### ❌ Actual Behavior

Memory usage keeps increasing, making extension activation slower with continued use of the command palette and eventually requiring a restart.

### Upload Bug Report ZIP-file

_No response_

### Other Software

I initially suspected the issue was caused by the extension.

However, after debugging, I confirmed that only `GetItems` is invoked when the extension is activated if there is no search text.

Refer to video below, there’s no search input and just keep activating extension via hotkey and memory keep growing from 8MB to 13MB

https://github.com/user-attachments/assets/cccbf74d-e786-42c5-833a-03386073fbcf

From the extension code, since there is no search text, `GetItems` will always returns `_combinedItemsCache`, which shouldn’t lead to any memory leak.
https://github.com/tanchekwei/VisualStudioCodeForCommandPalette/blob/v1.26.0.0/WorkspaceLauncherForVSCode/Pages/VisualStudioCodePage.cs#L127-L157

Based on this, the extension code can likely be ruled out as the cause.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.