[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

DLL not being release from memory

Posted on 2003-11-18
7
Medium Priority
?
169 Views
Last Modified: 2010-05-03
I develop a program that use late binding to call a dll to load a form and release the dll once the form is loaded so that I can change or recompile the dll that is situated in the server even if the form is loaded in the client computer. The problem is the dll is not release after the form is loaded. It didn't even release after the client close the form. Do any of you guys know how can I go about it ?

my code is as follow;

Private Sub TreeView1_DblClick()
   
        ' late binding
       
        Dim objNew As Object
        Set objNew = CreateObject("InventorySystem.clsInventorySystem")

       'load the form base on what the use click on the treeview
        objNew.LoadForm Trim(TreeView1.SelectedItem.Text), strModuleMode

        ' release the object
        Set objNew = Nothing
       
End Sub
0
Comment
Question by:ericgan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 29

Accepted Solution

by:
Nightman earned 580 total points
ID: 9770194
A little known issue with vb - while setting the object = nothing destroys the pointer to the object in memory, the object is not actually released until the calling application is terminated - this applies if you are late binding or if you have a project reference to the dll. I'm sorry, but I don't think there is an alternative.

Additionally, if the new version of the dll is not binary compatable with the old one, you will have to recreate the COM+ package and deploy it again on the client computers. The same goes if the interface has been extended.

Cheers
Night
0
 
LVL 9

Assisted Solution

by:_ys_
_ys_ earned 580 total points
ID: 9772462
Try invoking CoFreeUnusedLibraries:
Declare Sub CoFreeUnusedLibraries Lib "OLE32" ( )

t's typically not called by VB. This _may_ unload the dll for you - if all references to active objects have been released.

Rumours have it there's a 10 minute delay built in, but I'm not convinved.
0
 
LVL 29

Expert Comment

by:Nightman
ID: 10162678
Split point between Nightman and _ys_
0
 
LVL 9

Expert Comment

by:_ys_
ID: 10172601
I would be really interested to hear the result of the call to CoFreeUnusedLibraries. It's commanly called from good old C++ code, but as for VB code ... well, that's what I'm interested in.

Maybe ericgan can shed some light on this.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10548685
Moderator, my recommended disposition is:

    Split points between: Nightman & _ys_

Dan Rollins -- EE database cleanup volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question