Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Performance / January 2005

Tip: Looking for answers? Try searching our database.

garbage collections in circular references

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Allen Anderson - 14 Jan 2005 21:35 GMT
If I have an object MYCONTROL that has a reference to object A that
subscribes to an event of object B and has a reference to object B in
its Items collection that is a member of object A.  Object B also has
a reference varialbe Parent that points to object A.  If I null the
reference to object A in MYCONTROL, will object A and B get garbage
collected or will they live forever in their circular reference?
Jon Shemitz - 14 Jan 2005 22:27 GMT

> If I have an object MYCONTROL that has a reference to object A that
> subscribes to an event of object B and has a reference to object B in
> its Items collection that is a member of object A.  Object B also has
> a reference varialbe Parent that points to object A.  If I null the
> reference to object A in MYCONTROL, will object A and B get garbage
> collected or will they live forever in their circular reference?

A circular reference in unreferenced data doesn't trouble the garbage
collector at all. That is, if no live data refers to A or B, they will
be collected, no matter how many different ways they refer to each
other.

Signature

www.midnightbeach.com

Allen Anderson - 14 Jan 2005 22:31 GMT
great, that's exactly the part I was wanting to make sure of.  Thanks
for the info.

>> If I have an object MYCONTROL that has a reference to object A that
>> subscribes to an event of object B and has a reference to object B in
[quoted text clipped - 7 lines]
>be collected, no matter how many different ways they refer to each
>other.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.