• 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: multithreading textviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multithreading textviews


  • Subject: Re: multithreading textviews
  • From: "John C. Randolph" <email@hidden>
  • Date: Thu, 22 Nov 2001 01:37:27 -0800

On Thursday, November 22, 2001, at 12:40 AM, Drew McCormack wrote:

In Cocoa/Obj-C, an NSAutoReleasePool does the garbage collecting (to use your native java terminology). It updates the retain count (reference count) of each object which has been 'autoreleased' in the past event loop iteration. If the count hits zero, the object is deallocated. The thing you need to realize is that each thread needs to have its own autorelease pool.

This isn't quite accurate. Objects keep their own retain count, whether or not there's an autorelease pool in place. The autorelease pool is nothing more than a means to queue up -release messages that will be sent whenever the pool is released.

Each thread needs its own autorelease pool *if* anything in that thread is going to call -autorelease. This isn't always the case: for example, you might spawn a thread that runs a straight C function that doesn't make use of any Foundation Kit classes.


-jcr

"This is not a book to be tossed aside lightly. Rather, it should be hurled with great force." -Dorothy Parker


  • Follow-Ups:
    • Re: multithreading textviews
      • From: Cornelius <email@hidden>
References: 
 >Re: multithreading textviews (From: Drew McCormack <email@hidden>)

  • Prev by Date: all apps to open one file
  • Next by Date: automatic spell checking
  • Previous by thread: Re: multithreading textviews
  • Next by thread: Re: multithreading textviews
  • Index(es):
    • Date
    • Thread