[Newbies] What is a "weak" reference
Rob Rothwell
r.j.rothwell at gmail.com
Sun Jul 13 16:15:43 UTC 2008
Can someone explain what a "weak" vs (I am guessing) "strong" reference is?
I have been struggling with Garbage Collection for quite some time now and
saw this on another list:
"You'll need to add an instance variable to process and modify fork to
record the origin. Currently processes don't remember their ancestor. I
recommend you create a special fork that remembers ancestry, rather than
modifying the default fork. You will potentially accumulate a lot of
garbage otherwise. Also, you might consider making the reference from a
process to its parent weak to allow the parent to be GC'ed when it
terminates even if it has children."
I, too, am maintaining parent/child relationships in my application and have
just been doing something like:
Parent>>createChild
|child|
child := Child new parent: self.
^child
I am assuming, given my troubles, that this is NOT a weak reference?!
Thank you,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080713/1e10cf75/attachment.htm
More information about the Beginners
mailing list