• 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: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)


  • Subject: Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
  • From: Frédéric Testuz <email@hidden>
  • Date: Wed, 25 Feb 2009 18:35:13 +0100

Le 25 févr. 09 à 00:44, Jonathan Hess a écrit :


On Feb 20, 2009, at 1:05 AM, Alexander Spohr wrote:


Am 20.02.2009 um 04:18 schrieb mmalc Crawford:


On Feb 19, 2009, at 12:34 PM, mmalc Crawford wrote:

See also updated: <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html >


The Doc states: You should therefore also set outlet variables to nil in dealloc:

- (void)dealloc {
	// release outlets and set outlet variables to nil
	[anOutlet release], anOutlet = nil;
	[super dealloc];
}

why not just use

	[self setAnOutlet = nil];
or
	self.anOutlet = nil;

Any danger in this? (except a bad implementation of setAnOutlet:)


Any of the standard arguments about not calling setters in dealloc and init would apply. For example, if you were subclassed, and your subclass had an override of one of your setters, and you called it from dealloc you'd be calling one of their methods after they'd called [super dealloc]. Or, you might later implement side-effects for one of your setters not thinking about the called-from-dealloc- case and introduce a subtle bug into your own code.

One question about this.

If I understand correctly the 64bit runtime, for property we don't have to declare ivar.
Then, if I want to init a property and clear it in dealloc I must do :


self.myProperty = anObject;  // in init

and

self.myProperty = nil;  // in dealloc

Does it mean I must always declare ivars even for 64bit only architecture ?

Frédéric_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
      • From: mmalc Crawford <email@hidden>
References: 
 >Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations) (From: James Montgomerie <email@hidden>)
 >Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations) (From: mmalc Crawford <email@hidden>)
 >Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations) (From: mmalc Crawford <email@hidden>)
 >Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations) (From: Alexander Spohr <email@hidden>)
 >Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations) (From: Jonathan Hess <email@hidden>)

  • Prev by Date: Re: NSDate And Super Class
  • Next by Date: Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
  • Previous by thread: Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
  • Next by thread: Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
  • Index(es):
    • Date
    • Thread