realbasic-nug
[Top] [All Lists]

Re: Circular reference powers used for good?

To: "REALbasic NUG" <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Circular reference powers used for good?
From: "Adam Shirey" <adam dot shirey at gmail dot com>
Date: Mon, 31 Dec 2007 16:42:41 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <1F31400A-2192-40FA-B482-EAAD05F0C530 at oxalyn dot com> <31becf620712310609n6bc59eebt909110f741481fc7 at mail dot gmail dot com> <3C9E9382-6D09-482B-AD65-6A017E856616 at oxalyn dot com> <E7E70A12-4A48-4BC1-8647-0932BF2660E8 at sentman dot com>
On Dec 31, 2007 4:22 PM, James Sentman <james at sentman dot com> wrote:

> That being said there is nothing wrong
> with circular references! I use them all the time for similar things,
> a timer that stores a reference to it's socket for example so that it
> can signal a timeout and the socket maintains a reference to the timer
> so that it can cancel or reset it. This is a circular reference and if
> you just kill the socket and set it's reference in whatever list you
> hold them in to nil that socket and it's timer will hang around lost
> in memory forever because they still reference each other.


Not so. The reason they hang around in memory is because sockets are a
special case and are not destroyed even when their reference is lost. See
Aaron's Socket Readme: "One of the new features of sockets in
REALbasic 5.0is the ability to orphan a socket... The socket will
continue to live and
stay connected, even though there is nothing owning a reference to it." This
has been a feature of sockets for a few years now.



-- 
-Adam
dingostick.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>