• 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: Analyzer Messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Analyzer Messages


  • Subject: Re: Analyzer Messages
  • From: David Duncan <email@hidden>
  • Date: Thu, 11 Aug 2011 13:16:23 -0700

Title: Analyzer Messages
On Aug 11, 2011, at 1:00 PM, Gordon Apple wrote:

I’m getting a lot of this.  Is this just an issue with the analyzer, or am I missing something?

The analyzer doesn't do inter-procedural analysis, so it can't see this particular situation. That said, I would still consider it a dangerous pattern because...

        self.captureManager = [[AVCamCaptureManager alloc] init];

This uses the only owning reference you have to this object anonymously, preventing you from releasing it...

        [self.captureManager release];

… while this is releasing an object that you do not own (since you don't own the return value of an accessor).

Basically the pattern you are using is not considered safe. Especially consider if you decided that you needed to change a property like this to be copy instead of retain – suddenly your release doesn't balance the alloc anymore.

In general when I've seen this pattern in other source bases, it is lead to a number of subtle issues and often to workarounds like [self.foo retain] that are should not be necessary. As such, I would recommend abolishing this pattern from your code base.
--
David Duncan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Analyzer Messages (From: Gordon Apple <email@hidden>)

  • Prev by Date: Re: Analyzer Messages
  • Next by Date: Re: Analyzer Messages
  • Previous by thread: Re: Analyzer Messages
  • Next by thread: Found: Replacement for "Front End" of User Scripts
  • Index(es):
    • Date
    • Thread