• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Allocation in Pools and threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Allocation in Pools and threads


  • Subject: Re: Allocation in Pools and threads
  • From: Charles PARNOT <email@hidden>
  • Date: Tue, 15 Jun 2004 11:51:22 -0700

At 23:19 -0400 6/14/04, Ken Tozier wrote:
>Is it necessary to always create a new NSAutoreleasePool in detached threads?
Only if you use autoreleased objects, which maybe you are not, if this is just an "intensive calculation" thread with some pure C stuff.

>And if so, what happens to objects allocated between the creation and disposal of the pool?
The autoreleased ones stay alive until you release the pool. The others go away when their retain count get to 0.

>
>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?
The data won't get zapped. Just be sure that the object that you are writing too is retained in your thread, so you are not writing to an object dealloced in another thread. Also, you should probably have a NSLock in your setter.

--
Charles PARNOT
email@hidden

Help science go fast forward:
http://cmgm.stanford.edu/~cparnot/xgrid-stanford/

Room B157 in Beckman Center
279, Campus Drive
Stanford University
Stanford, CA 94305 (USA)

Tel +1 650 725 7754
Fax +1 650 725 8021
_______________________________________________
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.


References: 
 >Allocation in Pools and threads (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Big Nerd Ranch Experience
  • Next by Date: Re: Big Nerd Ranch Experience
  • Previous by thread: Re: Allocation in Pools and threads
  • Next by thread: NSBitmapImageRep questions
  • Index(es):
    • Date
    • Thread