• 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: Questions regarding release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions regarding release


  • Subject: Re: Questions regarding release
  • From: "Glenn L. Austin via Cocoa-dev" <email@hidden>
  • Date: Thu, 26 Sep 2019 08:16:26 -0700

The analyzer is great at what it does but it can't be omniscient about your
code.

When you start a method name with "make" or "new" or "create" it assumes that
you're returning a +1 value.

--
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
<http://www.austinsoft.com>

> On Sep 26, 2019, at 6:05 AM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
>
>>
>> The Xcode "analyze" step should check for errors of this kind. I have xcode
>> set to analyze on every build, since it's usually not too slow.
>
> Thanks a lot for the hint!
>
> I tried it and it works pretty well.
> I actually found 2 (small) leaks.
>
> There is one place in my code (different from my OP),
> where I get a "leaked" warning from the Analyzer, but I am not sure why that
> is.
>
> Here is what the function basically does:
>
> - (void) makeTextLayerRectangle: (CATextLayer*) textlayer fontsize: (float)
> fontsize text: (NSString*) text
> {
>   ...
>    textlayer.bounds = CGRectMake( 0.0, 0.0, string_rect.width,
> string_rect.height );
>    textlayer.shadowPath = CGPathCreateWithRect( textlayer.bounds, NULL );
> }
>
>
> But I get the warning
> "Object leaked: allocated object of type 'CGPathRef _Nonnull' is not
> referenced later in this execution path and has a retain count of +1"
>
> Note that text layer is a call-by-reference var.
>
> Is that just a bug in the Analyzer? Am I missing something?
>
> Best regards, Gabriel
>
> _______________________________________________
>
> 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

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________

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

  • Follow-Ups:
    • Re: Questions regarding release
      • From: Mike Abdullah via Cocoa-dev <email@hidden>
References: 
 >Re: Questions regarding release (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Views without any layout constraints may clip their content or overlap other views
  • Next by Date: Re: A question in regards to AddInstanceForFactory
  • Previous by thread: Re: Questions regarding release
  • Next by thread: Re: Questions regarding release
  • Index(es):
    • Date
    • Thread