• 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: NSThread and memory management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread and memory management


  • Subject: Re: NSThread and memory management
  • From: Luc Heinrich <email@hidden>
  • Date: Tue, 3 Jul 2001 07:54:23 +0200

On Monday, July 2, 2001, at 09:28 , Rob Rix wrote:

So, obviously it can send a message to the object in the new thread, which can call [NSThread exit], but what I want to know is whether or not this will leak:
Will the autorelease pool and other objects in the spawned thread be removed when the thread exits?

Send an 'invalidate' message to the sending NSPort of your NSConnection (on the thread side) or the receive NSPort of your NSConnection (on the main thread side):

[[theInterthreadConnectionInMainThread receivePort] invalidate];

or

[[theInterthreadConnectionInSpawnedThread sendPort] invalidate];

This will invalidate the connection on the other side of the fence, causing your thread runloop to peacefully abort and therefore you thread to exit, calling any regular cleanup code (like [pool release] for example :-) ) on its way out.

--
Luc - email@hidden


References: 
 >NSThread and memory management (From: Rob Rix <email@hidden>)

  • Prev by Date: How do I get services?
  • Next by Date: Re: Several questions
  • Previous by thread: NSThread and memory management
  • Next by thread: Re: NSThread and memory management
  • Index(es):
    • Date
    • Thread