Re: Newbie: Object life within a method scope
Re: Newbie: Object life within a method scope
- Subject: Re: Newbie: Object life within a method scope
- From: Joseph Feld <email@hidden>
- Date: Wed, 23 Feb 2005 10:39:55 -0500
on 2/23/05 2:37 AM, Kevin Viggers at email@hidden wrote:
> Hi Joe,
>
> Have a read over the NSAutoreleasePool documentation as well. It might
> be helpful for you to get a feel for how the mechanism works, so that
> you see that there really isn't anything magically going on. The
> important point in regard to your question is that (in your typical
> mono-thread app) any actual work a NSAutoreleasePool does towards
> releasing objects happens in the *same* thread of execution as your
> method. Intuitively this means that even if your method receives as
> argument some object slated for reclamation, you can be confident that
> the object will not be de-allocated while your code controls the
> thread.
>
> It would seem that your Java conditioning is steering you towards the
> idea that objects are reclaimed by a separate thread (akin to the GC
> thread in Java) and that objects could potentially be pulled out from
> under your code, but this is typically not the case. It is only when an
> object is shared between threads that this becomes a true concern.
I think you hit the nail on the head, Kevin. I was just assuming without
thinking about it that the actual object cleanup was happening in another
thread once my objects signaled their readiness to be cleaned.
Java-thinking, I know :-)
Thanks all for the replies, especially the documentation pointers (StepWise
looks like a great resource).
Joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden