• 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: Simple memory problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple memory problem


  • Subject: Re: Simple memory problem
  • From: Bill Bumgarner <email@hidden>
  • Date: Fri, 06 Feb 2009 08:19:00 -0800

On Feb 6, 2009, at 5:32 AM, harry greenmonster wrote:
However, from a usability point of view, my points are still valid. Code such as inputString = [inputString myMethod]; looks to me like inputString data is no longer wanted, which in my case it wasn't.

It is impossible for the compiler to know that 'inputString' is no longer wanted. There is no way for the compiler to know what myMethod might do with, in this case, 'self'.


Example; myMethod might decide to store a reference to self somewhere without retaining it because it assumes that the caller has retained it and won't be releasing it (as your original code did).

Certainly, wrong by the terms of the documented patterns, but not invalid.

As much as, in your specific case, you found this particular bit of behavior surprisingly lacking, there would be any number of developers that would be equally as surprised -- if not more so -- that compiler is magically manipulating retain counts behind their back.

(As someone else said, use properties, @synthesize, and garbage collection)

b.bum

_______________________________________________

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: 
 >Re: Simple memory problem (From: Scott Ribe <email@hidden>)
 >Re: Simple memory problem (From: harry greenmonster <email@hidden>)
 >Re: Simple memory problem (From: Bryan Henry <email@hidden>)
 >Re: Simple memory problem (From: harry greenmonster <email@hidden>)

  • Prev by Date: Re: NSTableView Popup Column issue
  • Next by Date: Re: Quicktime Movie View error
  • Previous by thread: Re: Simple memory problem
  • Next by thread: Re: Simple memory problem
  • Index(es):
    • Date
    • Thread