explorer memory leak

Pavel Pecha 0 Reputation points
2025-07-02T14:16:54.5966667+00:00

Hello, i have noticed rather annoying bug with explorer.exe, i was used to open folders with explorer through shellexecute with some params...windows explorer seems to be borked now, anytime it opens, it opens as a new instance and even if folder gets closed, explorer instance remains and is eating memory, its not closing, run it few times and few gigs of ram is gone (200MB per explorer instance), until explorer gets restarted (manualy), can be reproduced with winexec or even with WIN+R (run).

steps to reproduce:

open task manager - details page, and sort by name

notice explorer.exe (should be single instance there)

press WIN + R and type in "explorer %onedrive%"

folder will open, close it

repeat multiple times

now look up in task manager (if you didnt already), each explorer call creates new instance, its not closing with folder close

so anyway, is there any usable alternative to explorer with commandline switches or api calls?

Windows for home | Windows 11 | Files, folders, and storage
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Trinh 1,355 Reputation points Microsoft External Staff Moderator
    2025-07-02T15:49:53.6933333+00:00

    Hello, Pavel Pecha

    Thank you for your feedback. As you have observed, the normal behavior should be: explorer.exe runs continuously as the main shell process (responsible for the taskbar, desktop, etc.). When you open a folder via Win+R, ShellExecute, or other methods, the main process should handle the request and create a new window thread in its own context. When you close that folder window, only that thread is destroyed, while the main process remains active, with stable memory usage. Other community members are experiencing the same issue.

    Currently, the options are either to attempt to fix or workaround this bug in the native Explorer, or, as you asked, to seek a powerful alternative.

    1. Fixing or bypassing the native Explorer behavior

    In some cases, using the built-in start command in cmd.exe is more robust than directly calling explorer.exe. The start command has its own logic for handling path resolution and launching applications, which can sometimes bypass Explorer's bug.

    Try running the following in WIN+R:

    start %onedrive%

    Or in your code, call cmd.exe /c start “” “%onedrive%”. This approach sometimes correctly passes the message to the main shell instead of triggering a new process.

    1. Use a powerful third-party file manager

    If you're tired of Explorer's unreliability or need more advanced features (such as scripting, advanced command-line control, etc.), switching to a high-quality third-party file manager is an excellent choice. Examples include Total Commander, Files App, etc.

    I look forward to your feedback. 

    Best regards,
    Ian Trinh | Microsoft Q&A Specialist


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.