Windows does not unload dll files a program has used after it has been closed, to speed up a possible restart of the program.


Use Regedit to edit: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer Add the DWORD value named: AlwaysUnloadDLL and set it to 1

Dani AI

Generated

The registry tweak posted by has a real origin, but it is narrowly targeted and not a general “free RAM now” fix. Microsoft documents the setting as a shell/debugging convenience that shortens the time the Shell waits before unloading unused shell‑extension DLLs — it was intended to help developers, not to be a blanket memory optimizer. (learn.microsoft.com)

Modern Windows keeps DLL code pages shared and cached for performance; those code pages are reused by other processes and are reclaimed by the memory manager when needed. Forcing immediate unloads usually gives negligible reclaimed physical RAM and can slow things down (or cause instability) because the OS must reload the same images later. To see what is actually using working set and how much of a DLL is shared vs private, use Process Explorer’s DLL/mapped‑file view rather than registry “tweaks.” (learn.microsoft.com)

Practical advice: if you are actively developing or debugging a shell extension, follow Microsoft’s shell‑debugging guidance; otherwise diagnose real memory pressure with Task Manager or Process Explorer, stop or update the offending process/extension, reduce startup apps, or add RAM. Third‑party “DLL unload” utilities (as and others noted) rarely change OS memory behaviour in any useful way, so prefer diagnostic tools over registry hacks. (learn.microsoft.com)

Recommended Answers

All 4 Replies

Thanks for this. However, what advantage does unloading DLLs have? Does it free up RAM?

Yes .. the programs use dll libraries but they are not automatically unloaded ... taking a pretty much amount of ram .. only for users who dont restart programs frequently( frequently means a lot of times in one session).

how to unload dll:

I use warecase XTM. Very efficient tool to unload dll and to control other internal processes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.