How to unload Active X from memory

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to unload Active X from memory

khaaf
A dll i am using has a memory leakage problem....therefore I would like to
unload and load the dll.

Any ideas :-)

txs


Reply | Threaded
Open this post in threaded view
|

Re: How to unload Active X from memory

Blair McGlashan-3
"fnaji" <[hidden email]> wrote in message
news:[hidden email]...
>A dll i am using has a memory leakage problem....therefore I would like to
> unload and load the dll.

You can try releasing all interface pointers, and then calling
CoFreeUnusedLibraries() (which you'll have to add to the OLELibrary class).
I've never had much success with this, however, as it depends on the
underlying library indicating that it is ready to be unloaded. If it is
leaking, there is a fair chance it has leaked interface pointers as well, in
which case it will think it cannot be unloaded.

As a more extreme measure you could try finding is module handle (hLib :=
KernelLibrary default getModuleHandle: <dllname>), and then explicitly free
it (KernelLibrary default freeLibrary: hLib). If you free something you
shouldn't have, then the system will either crash immediately, or sometimes
on shutdown. Even using this extreme measure you may find the DLL does not
unload.

Your best alternative may be to run a separate executable to host the
Active-X (or DLL if not an A-X). Depending on the Active-X you might be able
to host it in a standard exe host, such as dllhost (see MSDN for more info
on that), or you might need to write a server to host it.

Regards

Blair