Re: NSAllocateCollectable() questions
Re: NSAllocateCollectable() questions
- Subject: Re: NSAllocateCollectable() questions
- From: "Michael Ash" <email@hidden>
- Date: Wed, 16 Apr 2008 12:26:20 -0400
On Wed, Apr 16, 2008 at 12:04 PM, Clark Cox <email@hidden> wrote:
> The purpose of the write barrier is to tell the collector to keep
> something alive; it has nothing to do with when to collect it.
Right, I get that now.
[snip]
> Garbage Collection:
> The housekeeping is taken care of, I don't have to worry about it.
> However, I cannot know exactly when my object will be destroyed (it
> might be right away, it might be in a couple of seconds).
I don't see the relevance of this. The Cocoa GC explicitly only works
properly if you play by the rules it sets out. For example, if you
store a pointer in unscanned memory then you're playing with fire and
the object may well have been destroyed by the next time you try to
use it. Skipping write barriers likewise. I had thought that using
write barriers for clearing memory was part of the required rules, but
now it appears that it is not. But regardless, Cocoa GC only takes
care of its housekeeping when you take care of yours.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden