|
-
May 25th, 2005, 05:06 PM
#1
Thread Starter
Junior Member
DLL not being released
I'm having a strange problem within VB6, here's a simple example where an app calls a DLL which prompts a message box and nothing else. Why does the DLL remain in memory after completing the call to the DLL. I know it is still in memory because i cannot recompile the DLL while the calling app is still running. What's going on!
DLL:
VB Code:
Public Function Test()
MsgBox "Test"
End Function
My App calling the DLL:
VB Code:
Dim obj As Object
Set obj = CreateObject("Test.Class1")
Call obj.test
Set obj = Nothing
-
May 26th, 2005, 06:24 PM
#2
Re: DLL not being released
The app must specifically be shut down to release the file handle lock.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
May 26th, 2005, 06:28 PM
#3
Thread Starter
Junior Member
Re: DLL not being released
Do my resources get eaten up if i call the DLL several times from my calling App in the same manner as my example above?
-
May 26th, 2005, 06:30 PM
#4
Re: DLL not being released
No. Call it as many times as you like. The way resources get eaten up is by NOT releaseing an object, which you are doing.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
May 26th, 2005, 06:39 PM
#5
Thread Starter
Junior Member
Re: DLL not being released
It seems to me the file handle lock is only part of it. My dll starts up by calling mod main, which get's executed the first time i call the DLL, but not the subsequent times. Is that normal?
-
May 26th, 2005, 10:52 PM
#6
Re: DLL not being released
Yes, it could be normal, depending on the type of project it is.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Jun 15th, 2005, 07:17 AM
#7
Frenzied Member
Re: DLL not being released
This could be, as has been mentioned, normal behaviour. You are using CreateObject which will invoke the schedule control manager (SCM) to create the instance of your object.
This means the lifetime of the object is controlled by the COM+ runtime, and not by the VB6 runtime.
COM+ can often keep objects active for what seems like for ever (2 minutes) because this improves performance by bypassing the object creation time.
Try using the 'new' operator. This will (sometimes) make sure that the VB6 runtime will handle object creation, and destruction - which is faster. You should be using this anyway if the class is on the local machine.
Let me know if this works.
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|