• 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: Xcode Analyze memory misunderstanding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode Analyze memory misunderstanding


  • Subject: Re: Xcode Analyze memory misunderstanding
  • From: Jonathan del Strother <email@hidden>
  • Date: Thu, 27 Aug 2009 11:44:40 +0100

On Thu, Aug 27, 2009 at 11:29 AM, Reza Farhad<email@hidden> wrote:
> Dear all
>
> I am running my code through xcode "Build and Analyze" to check for bugs.
> I have the function below which gives me the following error:
>
> Object with +0 retain counts returned to caller where a +1 (owning) retain
> count is expected
>
> I can not understand why can anybody enlighten me.
>
> -( NSColor *)newColour
> {
>        NSColor         *todoColour = nil;
>        float           newRed, newGreen, newBlue;
>        float           newAverage;
>        do{
>                todoColour = [ self variationOnColor:colour ];
>                [ todoColour getRed:&newRed green:&newGreen blue:&newBlue
> alpha:nil ];
>                newAverage = ( newRed + newGreen + newBlue )/3;
>        }while( newAverage < 0.5 );
>        return todoColour;
> }
>


>From here - http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043-BEHDEDDB
- methods starting with 'new' should return retained objects.  Your
code is functionally fine, it just doesn't follow the usual
convention.
_______________________________________________

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: 
 >Xcode Analyze memory misunderstanding (From: Reza Farhad <email@hidden>)

  • Prev by Date: Xcode Analyze memory misunderstanding
  • Next by Date: Reasons why QL would fail to create thumbnail?
  • Previous by thread: Xcode Analyze memory misunderstanding
  • Next by thread: Re: Xcode Analyze memory misunderstanding
  • Index(es):
    • Date
    • Thread