[dba-VB] VB6: Object Reference

Bryan Carbonnell carbonnb at sympatico.ca
Fri Apr 18 10:48:55 CDT 2003


On 18 Apr 2003 at 10:15, Brett Barabash wrote:

> My only issue with your method, is that it requires the parent code to
> explicitly call the TearDown method to destroy the object.  If the
> TearDown method isn't called (crashes, sloppy code, whatever), the
> object will remain in memory.

Yep, same issue I have with doing it that way as well. Unfortunately, 
it's about the only way I can think of to do it.

IIRC, I got this methid from the VBADH by Getz & Gilbert.

> I ran across a very interesting article through Google groups, about
> establishing "Weak References".  Using the CopyMemory API call, you
> can establish an uncounted reference to an object and avoid the common
> circular reference problems.  A little bit more work and more risky
> (as an uncounted interface, you need to handle cleanup manually). 
> Still, an interesting read:
> http://groups.google.com/groups?selm=7uluuc%24srp%241%40nntp1.atl.mind
> spring .net&oe=UTF-8&output=gplain

Sounds like an interesting read. I must add it to my ever growing 
collection of things to read.

--
Bryan Carbonnell - carbonnb at sympatico.ca
We've all heard that a million monkeys banging on a million 
typewriters will eventually reproduce the entire works of 
Shakespeare.
Now, thanks to the Internet, we know this is not true.^ [Robert 
Wilensky (1997)]




More information about the dba-VB mailing list