Memory leaks in VB6
Posted on 2004-04-12
I am having a major problem with a new application we have written. The application uses a number of DLLs, all of which were written in VB. We call the DLLs via:
Dim obj as DLLName.Class
set obj = new DLLName.Class
set obj = nothing
When we call each DLL, depending on the DLL, the working set of memory for our app increases. This makes sense.
The problem is that after we are done with the DLL and set the object to nothing, while the DLL appears to unload from memory (using Process Explorer to view it) the memory for our app still remains high! Even after a few hours it doesn't go back down.
We tested this by writting a little test app which creates a new XML file, adds 200K to the file and then closes it. Memory spikes from 3Megs to 25Megs and then, after closing, drops to 20Megs (not the 3Megs).
Is there a better way (memory wise) of loading, calling and unloading DLLs from memory that would result in freeing up memory after you are finished with an object?