On Dec 31, 2007, at 3:42 PM, Adam Shirey wrote:
> 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.
That's true, but it's ALSO true that any objects with any references
to them (including circular ones) will continue to hang around and
not be destroyed.
This includes objects which your code has no way to access, because
apart from the circular references, there are no "outside" references
to them. For example:
Sub Foo
Dim a As New Whatever
Dim b as New Whatever
a.foo = b
b.foo = a
End Sub
Every time you call subroutine Foo, two new Whatevers will be created
and leaked; they are not destroyed and continue to exist forever,
though you have no way to reference them. This is just normal and
standard behavior of any reference-counting memory management
system. For these objects to be destroyed automatically would
require a garbage collector, which REALbasic does not have. (And I'm
generally glad that it doesn't -- I think ref-counting is a superior
system in most cases. Just don't do silly stuff like the above.)
Best,
- Joe
--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|