• 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: real authority on what needs to be released
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: real authority on what needs to be released


  • Subject: Re: real authority on what needs to be released
  • From: Dietrich Epp <email@hidden>
  • Date: Wed, 11 Sep 2002 13:11:49 -0700

On Wednesday, September 11, 2002, at 09:43 , James DiPalma wrote:

From: Dietrich Epp <email@hidden>

Autorelease pools are to free things from methods other than those made with alloc/init.

NSAutoreleasePools do _not_ free anything and they do way more than release objects that where not "made with alloc/init" *. When they are dealloced, they simply send release to objects that received an autorelease message. NSObject's release method will decrement its retainCount by 1; if this objects retainCount now equals 0, this object will call dealloc on itself. NSObject's dealloc method will free its own memory.

* All objects are made with an alloc/init... method somewhere, so by your statement, NSAutoreleasePool does nothing. Good thing Apple has clearly defined what NSAutoreleasePool does by writing documentation (the first paragraph):

I'm not a bonehead, I just explained things more simply than you can tolerate. Next time just point the guy to the documentation and quit harassing those who give explanation a shot.

Basically you own anything you alloc/init, copy, or retain. Then you release it when you're done. If you don't own it, it's probably been autoreleased. When the autorelease pool is deallocated, objects in it will be released too - basically a delayed release.
_______________________________________________
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.
  • Follow-Ups:
    • Re: real authority on what needs to be released
      • From: Bill Cheeseman <email@hidden>
References: 
 >real authority on what needs to be released (From: James DiPalma <email@hidden>)

  • Prev by Date: Re: Decimal Tabs
  • Next by Date: NSTextAttachmentCell redraw with new size
  • Previous by thread: Re: real authority on what needs to be released
  • Next by thread: Re: real authority on what needs to be released
  • Index(es):
    • Date
    • Thread