# Unloading DLL's



## alamal (Sep 15, 2000)

Rick Selby's site has a section on how to unload DLL's (see below). It instructs to set the value to 1. How is this done and what should the figure look like after it's set to 1?

I'm not sure and don't want to restart unless I'm sure.

Thank you,
Peter

Force windows to unload DLL's from memoryAll Versions of windows)

Windows Explorer will usually try and cache DLL's by keeping them in memory even after the application using them has been closed. This can cause performance problems on low memory systems, and can be annoying when developing on Windows and the DLL's remain in use. 
Open your registry and find the key

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\ CurrentVersion\Explorer]

Create a new sub-key named 'AlwaysUnloadDll' and set the default value to equal '1' to disable Windows holding the DLL in memory. 
Restart Windows for the change to take effect.


----------



## TonyKlein (Aug 26, 2001)

Well, it's done exactly like Rick describes it.

However, here's an easier way:

Download the attached Unload.txt, save as (rename to) unload._reg_ (save as 'all files'), and doubleclick.

Answer yes when asked whether you'd like the contents of unload.reg added to the Registry.

Good luck,


----------



## alamal (Sep 15, 2000)

Geez, that was easy.

What I was asking for in the post however, was what the entry of 1 would look like.

What I couldn't do was delete a bunch of zeros before the 1. It looked something like this: 00000 010000.

Again, thanks so much Tony!
God Bless!!

Peter


----------



## Mosaic1 (Aug 17, 2001)

This is a very misunderstood concept. Have a look at my responses in this thread:

http://forums.techguy.org/showthread.php?threadid=103457



> The original reason for that tweak was to prevent programs from crashing. When there were several versions of the same file on the hard drive, a program which used an older version of a file (which was included n that particular Programs
> folder)would be opened and then closed .The file remained in memory. The User would open another program which used the same file. But , this program needed a newer version of that file. The file was already loaded, but it was the wrong version and didn't contain the code needed to run the newer program causing a crash. The Always Unload dlls tweak prevented this particular problem. All dlls were unloaded from memory as soon as their program closed. This also can slow things down.
> 
> In Windows 98, this was resolved by the creation of a special registry key. This key lists files which can only be opened if they live in Windows\System. If any of these files are found elsewhere, those copies will not be used. Here's that key:
> ...


----------

