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

Re: Properties and memory management


  • Subject: Re: Properties and memory management
  • From: Negm-Awad Amin <email@hidden>
  • Date: Tue, 5 Aug 2008 12:39:53 +0200


Am Di,05.08.2008 um 12:00 schrieb mmalc crawford:


On Aug 5, 2008, at 2:48 AM, Negm-Awad Amin wrote:

This is the "mirror" of the problem, when you initialize an object. Of course, theoretically in both cases the usage of setters are dangerous. In most cases the deallocation of the object in reverse order to its initialization will not lead to any problems. It is no problem, when you have synthisized accessors, because they have noch side-effects.

No, this is not the case -- Ken's reply was correct. If you use automatic KVO notifications, your accessors will still have side effects.
Again per Ken's reply, you should typically set instance variables directly in init methods, and release them directly in dealloc.


No, I think, that you should never, never have an observation, when - dealloc is running. *This* is the problem, not the KVO-Messages. If you are in -dealloc, the instance *will* be deleted. Since this happens running up the class hierarchy, the observing object has no chance to remove its observation before the object is deallocated. So in the moment of -dealloc (NSObject) you have an observation to an "dead object". *This* is the fault.

You always have to remove the observation before there is the chance of losing the object.
mmalc


Amin Negm-Awad email@hidden




_______________________________________________

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


References: 
 >Properties and memory management (From: Mike Manzano <email@hidden>)
 >Re: Properties and memory management (From: Jonathan Hess <email@hidden>)
 >Re: Properties and memory management (From: Uli Kusterer <email@hidden>)
 >Re: Properties and memory management (From: "Ken Ferry" <email@hidden>)
 >Re: Properties and memory management (From: Negm-Awad Amin <email@hidden>)
 >Re: Properties and memory management (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Message Framework and Garbage Collection
  • Next by Date: Localize App Title?
  • Previous by thread: Re: Properties and memory management
  • Next by thread: [Moderator] - List Guidelines and iPhone SDK NDA status
  • Index(es):
    • Date
    • Thread