Releasing all references of componant 
Author Message
 Releasing all references of componant

How can you know for sure when you have released all references to your
componant and that your componant has released all of its references.  Is
there an easy way to check to make sure everything in your componant in
being unloaded properly or do you have to go through your code bit by bit
and make a clear assumption that way...


Sat, 18 Oct 2003 22:28:08 GMT  
 Releasing all references of componant
You could put a break point into the class_terminate sub of the component
and see if you ever get to the break point.  That at least is a start.  If
you get to the break point then you know that all re references to that
component have been released.  If you don't get there, then the hunt is on!
Good luck...

Philip Meeks



Sat, 18 Oct 2003 23:07:54 GMT  
 Releasing all references of componant
Done and done...


Quote:
> You could put a break point into the class_terminate sub of the component
> and see if you ever get to the break point.  That at least is a start.  If
> you get to the break point then you know that all re references to that
> component have been released.  If you don't get there, then the hunt is
on!
> Good luck...

> Philip Meeks



Sat, 18 Oct 2003 23:14:26 GMT  
 Releasing all references of componant
Well a good indication of this is if your program terminates.  If your in the
IDE and you have a reference not being released, often you program will hang
until you hit the stop button.  One technique I've used to isolate and make sure
this is happening is to place a debug.print in all of my classes initialize and
terminate events. Ex:

Private Sub Class_Initialize()
    Debug.Print "**** Createing Instance Of MyClass At "; Now(); " ****"
End Sub

Private Sub Class_Terminate()
    Debug.Print "**** Destroying Instance Of MyClass At"; Now(); " ****"
End Sub

Then I run the program and make sure all the Creates have a matching destroy

Tom Shelton


Quote:
> How can you know for sure when you have released all references to your
> componant and that your componant has released all of its references.  Is
> there an easy way to check to make sure everything in your componant in
> being unloaded properly or do you have to go through your code bit by bit
> and make a clear assumption that way...



Sun, 19 Oct 2003 01:16:55 GMT  
 Releasing all references of componant
Hmmm... one way is to increment and decrement a class-specific global
variable on _initialise and _terminate events; this will give you an ongoing
indication that it's all unloading correctly, otherwise as new libraries and
sections are added, you can find that extra references can keep bits alive.
If it's a v. large application, I have had a debug window that can appear so
I can actually see object counts dropping. I'm fairly sure that some of the
commercial profilers do something similar via a VB add-in that will
effectively do the same thing.

Paul Bradbury.


Quote:
> How can you know for sure when you have released all references to your
> componant and that your componant has released all of its references.  Is
> there an easy way to check to make sure everything in your componant in
> being unloaded properly or do you have to go through your code bit by bit
> and make a clear assumption that way...



Sun, 19 Oct 2003 03:05:18 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Releasing all references of componant

2. Release a reference from System.Reflection

3. releasing a Com Server reference from Vb.Net

4. Releasing object references....

5. Releasing Reference to an Excel Object

6. Reference not released ?

7. VB won't release reference to COM object in use by another proces s

8. DirectX Events not releasing object reference

9. Release an Access reference

10. Killing client does not release object reference

11. Release an Access reference

12. RELEASE OBJECTS --> RELEASE MEMORY

 

 
Powered by phpBB® Forum Software