microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
107.01k stars 6.31k forks source link

Memory leak when previewing images with Peek #33593

Open daverayment opened 4 days ago

daverayment commented 4 days ago

Microsoft PowerToys version

0.81.1

Installation method

PowerToys auto-update

Running as admin

No

Area(s) with issue?

Peek

Steps to reproduce

  1. Navigate to a folder containing a selection of images. (The bug seems to occur with any number of images in the folder.)
  2. Click on any image and use the Ctrl+Space shortcut to open Peek.
  3. Use the arrow keys to navigate through the images in the folder.

✔️ Expected Behavior

Peek navigates through the images contained within the folder and uses a reasonable amount of memory, related to the size of the individual images being previewed. Subsequent navigations through the same images use the same amount of memory, i.e. the maximum memory used for previewing the folder images does not increase.

❌ Actual Behavior

The memory used by the application increases and is never reclaimed, leading to increased memory pressure on the system.

When the first image is displayed, the tool uses ~150MB:

image

After navigating through 500 images using the arrow keys, the tool uses ~1.4GB:

image

Some notes:

  1. Closing the tool does not free up the used memory.
  2. Leaving the system idle does not free up the used memory (I waited 30 minutes).
  3. Using Peek again after closing it does not free up the used memory.
  4. I am using default settings and PowerToys is running in User mode.

Bug report logs: PowerToysReport_2024-07-02-12-19-16.zip

Other Software

No response

github-actions[bot] commented 4 days ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

crutkas commented 4 days ago

I can repro this. Takes a bit with images but got it up to over 300mb and held. Quick glance at code "looks" like it does clean up but clearly it doesn't seem to.

We should validate all file times depending on fix