FROM : mmalc crawford
DATE : Mon Jun 02 20:40:13 2008
On Jun 2, 2008, at 10:50 AM, Bill Bumgarner wrote:
> If your window is sometimes disappearing under GC -- is sometimes
> being collected prior to when you think it should be -- that means
> that the collector doesn't believe that the window object is being
> used by your application. To the collector, being visible doesn't
> count as "in use".
> In GC, "in use" is defined entirely by whether or not you have a
> reference to an object. A pointer to the object somewhere in
> scanned memory (of which, any Objective-C object's data will be
> "scanned memory").
>
I wonder if this might be misleading.
Simply because you have a (strong) reference to an object does not
*necessarily* mean that it won't be treated as garbage.
Several objects may have strong references to each other (creating
what in a managed memory environment would be a retain cycle), but if
none of them is a root object, and none of them can be reached via
strong references from a root object, then they will all be treated as
garbage -- see the "F-G-H" example at <http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcEssentials.html
>.
mmalc
DATE : Mon Jun 02 20:40:13 2008
On Jun 2, 2008, at 10:50 AM, Bill Bumgarner wrote:
> If your window is sometimes disappearing under GC -- is sometimes
> being collected prior to when you think it should be -- that means
> that the collector doesn't believe that the window object is being
> used by your application. To the collector, being visible doesn't
> count as "in use".
> In GC, "in use" is defined entirely by whether or not you have a
> reference to an object. A pointer to the object somewhere in
> scanned memory (of which, any Objective-C object's data will be
> "scanned memory").
>
I wonder if this might be misleading.
Simply because you have a (strong) reference to an object does not
*necessarily* mean that it won't be treated as garbage.
Several objects may have strong references to each other (creating
what in a managed memory environment would be a retain cycle), but if
none of them is a root object, and none of them can be reached via
strong references from a root object, then they will all be treated as
garbage -- see the "F-G-H" example at <http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcEssentials.html
>.
mmalc






Cocoa mail archive

