Results 1 to 7 of 7

Thread: DLL not being released

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    25

    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:
    1. Public Function Test()
    2. MsgBox "Test"
    3. End Function


    My App calling the DLL:
    VB Code:
    1. Dim obj As Object
    2.  
    3. Set obj = CreateObject("Test.Class1")
    4. Call obj.test
    5. Set obj = Nothing

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    25

    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?

  4. #4
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    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.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    25

    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?

  6. #6
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    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.

  7. #7
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    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
  •  



Click Here to Expand Forum to Full Width