Re: Simple memory problem
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