G
Guest
Hi,
Lets take in mind the following scenario: Object A creates Object B and Object C, Object B and C are being initialized by object A so they reference each other ( Object B has a reference to object C and object C has a reference to object B ), no Object other then object A may use objects A and B so when object A is collected Objects A and B are not needed and should be collected as-well, Will objects A and B be collected by the GC?????
Using COM I would use a weak reference so Objects A and B will not effect each others reference count this will assure that deletion of object A causes objects B and C to be deleted as-well, what would happen in managed code? Is there an equivalent to a weak reference ( of course this should be managed solely by the framework ), how does the framework treat is kind of scenario?
Nadav
http://www.ddevel.com
Lets take in mind the following scenario: Object A creates Object B and Object C, Object B and C are being initialized by object A so they reference each other ( Object B has a reference to object C and object C has a reference to object B ), no Object other then object A may use objects A and B so when object A is collected Objects A and B are not needed and should be collected as-well, Will objects A and B be collected by the GC?????
Using COM I would use a weak reference so Objects A and B will not effect each others reference count this will assure that deletion of object A causes objects B and C to be deleted as-well, what would happen in managed code? Is there an equivalent to a weak reference ( of course this should be managed solely by the framework ), how does the framework treat is kind of scenario?
Nadav
http://www.ddevel.com