• 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: newbie question on 'Cocoa Programming for Mac OS X'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie question on 'Cocoa Programming for Mac OS X'


  • Subject: Re: newbie question on 'Cocoa Programming for Mac OS X'
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 11 Feb 2002 14:54:00 +0100

Lachlan,

>>>>>> Lachlan O'Dea (LOD) wrote at Mon, 11 Feb 2002 16:20:55 +1100:
LOD> >In those *extremely rare* cases when the autorelease pool might
LOD> >compromise effectivity, the primary solution is
LOD> >
LOD> >NSAutoreleasePool *localPool=[[NSAutoreleasePool alloc] init];
LOD> >NSMutableArray *tempArray=[NSMutableArray array];
LOD> >... work done here ...
LOD> >[localPool release];
LOD>
LOD> Isn't this still a problem if an exception is raised? [localPool
LOD> release] would not be executed in that case.

Although technically you are right (the command would not be executed
indeed), the contents of the pool -- including the tempArray -- *would be*
released. Which was the exercise goal ;)

(Check autorelease pools in more deails: there is a special support there to
release all "orphaned" pools if stack gets unwrapped -- with some slight and
unimportant degree of imprecision you can imagine that any local pool is
always automatically added into the pool which was current in the moment it
was init'd.)
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: 
 >newbie question on 'Cocoa Programming for Mac OS X' (From: Richard Chamberlain <email@hidden>)
 >Re: newbie question on 'Cocoa Programming for Mac OS X' (From: "Lachlan O'Dea" <email@hidden>)

  • Prev by Date: NSPortTimeoutException - Help!
  • Next by Date: Re: toolbar and switching a NSView
  • Previous by thread: Re: newbie question on 'Cocoa Programming for Mac OS X'
  • Next by thread: Re: newbie question on 'Cocoa Programming for Mac OS X'
  • Index(es):
    • Date
    • Thread