• 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: Memory management question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management question


  • Subject: Re: Memory management question
  • From: Ondra Cada <email@hidden>
  • Date: Wed, 24 Mar 2004 23:32:12 +0100

Alastair,

On Wednesday, Mar 24, 2004, at 23:10 Europe/Prague, Alastair Houghton wrote:

Also as has been pointed-out before, if you do accidentally write such code, you'll normally cause a crash, which makes it pretty easy to debug

Well, also, as has been pointed-out before, if you do accidentally write such code, there's a quite non-trivial probability you made a ticking bomb which just *happens* not to crash now, but will with a new framework/engine/library/bundle/haxie release... creating so one *extremely* hard-to-find bitch problem.

Nevertheless, I take it you are well aware of this part of the argument too, and am writing this message actually just for the benefit of other readers (who are truly invited to check the archives, where all the arguments of both sides are stated--many times over ;)--and judge for themselves whether they generally prefer safety or efficiency).

At the very least (again for the benefit of other readers, of course) it should be strongly pointed out that so far as one uses code with plain getters (and *especially* if the setters are just releasing /instead of autoreleasing/), one should be *very* careful with *any* code of kind

id o=[foo getter];
// any code here (*)
// o used now

and wherever there is the slightest suspicion the (*) code may, whatever indirectly or in future releases, cause the setter to be called, one should always use the safe pattern

id o=[[[foo getter] retain] autorelease];
// any code here
// o used now

instead.
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.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.


  • Follow-Ups:
    • Re: Memory management question
      • From: Alastair Houghton <email@hidden>
References: 
 >Re: Memory management question (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: [ANN] Shovel - Third-Party "Software Update"
  • Next by Date: Re: Memory management question
  • Previous by thread: Re: Memory management question
  • Next by thread: Re: Memory management question
  • Index(es):
    • Date
    • Thread