View Full Version : Garbage collector
08-11-2006, 04:48 PM
The garbage collector will only delete a variable from memory if there are no longer any references that variable. Is there a way for US to know whether or not a variable is still referenced somewhere? The application I'm putting together will mark an element for deletion, I'd then setup my own garbage collector to find and remove references to it so it will actually be deleted effectively. :D
08-11-2006, 05:24 PM
No, not that I know of. If you could check a variable at all then you'd have a reference to it.
08-11-2006, 09:07 PM
True, so it's up to me to design it that way from the start, only have just one reference to the element and the rest of the application access it through that one reference. Can that work? or does a reference through a reference nullify that?
08-11-2006, 09:39 PM
if anyone creates an additional reference through that reference, it would create another reference to the original object. Deleting that original reference would not affect the new reference so that really won't get what you want either.
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.