[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: Re: [cfe-dev] Static analyser and objc init methods
From: Jean-Daniel Dupas <devlists () shadowlab ! org>
Date: 2008-10-30 16:03:34
Message-ID: 21728091-EC33-4F11-BED4-4E0DA08154C1 () shadowlab ! org
[Download RAW message or body]
Le 30 oct. 08 à 16:43, Shawn Erickson a écrit :
> On Wed, Oct 29, 2008 at 3:37 PM, Jean-Daniel Dupas
> <devlists@shadowlab.org> wrote:
>> Hello,
>>
>> I think the memory leak analyser need a special semantic for objc
>> class initializer methods.
>>
>> Generaly, an initializer returns self, but in some case, it may
>> decide
>> to return something else (or throw an exception)
>> In these cases, 'self' must be release before the method returns else
>> it will leaks. (http://www.cocoabuilder.com/archive/message/cocoa/2008/2/11/198549
>> )
>>
>> Additionaly, if an init method returns a new object, this object
>> should be returns with a retain count to 1.
>
> I don't think that is a correct requirement, at least not directly
> as stated.
>
> It could be an application life long object with a possibly a MAX_INT
> retain count. It could be an object with a retain count greater then 1
> but with deferred releases (added to the current autorelease pool one
> or more times).
>
> -Shawn
>
You're right. It should not be exactly one.
Do you think the following assumption is right ?
Clang should considere init methods that does not return self just
like it does for "+alloc, -create… or -copy…" method family.
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic