[cfe-dev] Suppress: Static Analysis false positive.

Ken Ferry kenferry at gmail.com
Thu Feb 25 10:48:31 PST 2010


Ideally you should avoid this when programming Cocoa.  Retains and releases
should be balanced within every method, with certain structured exceptions
like accessors.  When you do it as you have here it isn't just harder for
the static analyzer, it's harder for you. For example, if the framework
added cancellation via new instance method and corresponding delegate
callback, you'd have to update your code to avoid a leak.

In this case, if possible, make the outstanding request a property of your
object.

-Ken
Cocoa Frameworks

On Thu, Feb 25, 2010 at 9:13 AM, Steven Osborn <osborn.steven at gmail.com>wrote:

> I have a bit of code I'm calling from a Apple's StoreKit library that
> looks something like:
>
> http://pastebin.com/1YgyXPf9
>
> Where you release the object in the callback function which leads to a
> false positive for a memory leak.
>
> I've dug through the documentation, but I can't find anything to help
> me suppress this particular warning.
>
> Thanks in advance,
>
> --
> Steven Osborn
> http://steven.bitsetters.com
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100225/073ae383/attachment.html>


More information about the cfe-dev mailing list