• 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: Releasing Objects Allocated in Different Autorelease Pool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Releasing Objects Allocated in Different Autorelease Pool


  • Subject: Re: Releasing Objects Allocated in Different Autorelease Pool
  • From: Chris Suter <email@hidden>
  • Date: Fri, 28 Jul 2006 13:11:40 +1000


On 28/07/2006, at 1:03 PM, Eric Blanpied wrote:

I've got a process on a separate thread which creates objects. This process has it's own autorelease pool, as the docs it seem to recommend. When I release these objects later on, it's done from the main thread. Watching the app in ObjectAlloc, I can see that these objects are never going away, and the various objects they reference don't seem to be getting deallocated, either.

Can someone explain the correct way to do this, please?

Thanks

-eric

There's nothing complicated about autorelease pools. When you release the pool, all queued objects in the pool get sent a release message. An object is queued in the thread's current release pool by sending an object the autorelease message. It doesn't matter which thread release is called in.


If your thread is going to be hanging around for a while, you should release the autorelease pool periodically and create a new one. The same goes for long running loops.

- Chris



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Releasing Objects Allocated in Different Autorelease Pool (From: Eric Blanpied <email@hidden>)

  • Prev by Date: Releasing Objects Allocated in Different Autorelease Pool
  • Next by Date: Mulitple controllers being made
  • Previous by thread: Releasing Objects Allocated in Different Autorelease Pool
  • Next by thread: Mulitple controllers being made
  • Index(es):
    • Date
    • Thread