Re: Allocation in Pools and threads
Re: Allocation in Pools and threads
- Subject: Re: Allocation in Pools and threads
- From: Greg Hulands <email@hidden>
- Date: Tue, 15 Jun 2004 13:33:40 +1000
On 15/06/2004, at 1:19 PM, Ken Tozier wrote:
Is it necessary to always create a new NSAutoreleasePool in detached
threads?
Yes. You will get a heap of _NSNoAutoreleasePool or something like that
in the log if you don't create a pool.
And if so, what happens to objects allocated between the creation and
disposal of the pool?
Those objects that have been asked to be autorelease or released, will
be deallocated at this time. Those that have not, will still be
available in memory.
The reason I ask is that I have a class that spawns a thread in one of
it's more time consuming methods but I want the method to write it's
results to an instance variable of the class when it's done doing it's
thing. Won't the data the method writes to the instance variable get
zapped when I release the pool?
Have you tried? It shouldn't do it.
Greg
Thanks
Ken
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.