Solved

DLL not being release from memory

Posted on 2003-11-18
7
164 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 145 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 145 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search combo error "Data Type Mismatch in Criteria Expression" 2 94
Hide vba in gp 7 125
VB6 - Convert HH:MM into Decimal 8 75
Set WorkSheet  not Working 9 62
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

738 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