tags:

views:

123

answers:

1

I have a mex module called p.mexw64 which uses another dll called p.dll
The mex module loads p.dll when it is loaded since it is linking to it's lib file.
Normally, when I want to recompile p.dll I do clear p;. This unloads p.mexw64 and then in turn also unloads p.dll.

Except when it doesn't. In some scenario which I can't really quantify p.mexw64 is unloaded (I see that it is in Process Explorer) but p.dll remain loaded and is not freed.
Then I'm forced to close matlab in order to recompile d.dll which is a pain.

What could possibly make this dll remain loaded after the mex which used it is gone?

+1  A: 

try clear all. Otherwise as a general solution, I find Unlocker an invaluable tool for Windows.

Amro
Unlocker can only unlock windows handles, not DLLs.
shoosh
Actually it does. Did it not work for you? I just noticed that you are using a 64-bit version of Windows
Amro