• 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: static analyzers says I'm leaking, I _think_ I'm not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static analyzers says I'm leaking, I _think_ I'm not


  • Subject: Re: static analyzers says I'm leaking, I _think_ I'm not
  • From: Charles Srstka <email@hidden>
  • Date: Thu, 07 May 2015 13:16:10 -0500

On May 7, 2015, at 6:44 AM, Daniel Höpfl <email@hidden> wrote:
>
> I'd change the code as follows:
>
> // init
> self.cycler = [[[GridCycler alloc] initWithGrid: self] autorelease];
>
> // alternative init, if you want to bypass the autorelease pool:
>
> GridCycler *cycler = [[GridCycler alloc] initWithGrid: self];
> self.cycler = cycler;
> [cycler release];
> // Don't use [self.cycler release], one day you might change the property to copy.
>
>
> // dealloc:
> // nothing.

The dealloc is wrong here; that still has to release the property, either by setting it to nil or by releasing the ivar (not through a property access). With MRC, properties aren’t automatically released on dealloc.

So, in dealloc, either:

[_cycler release];

or:

self.cycler = nil;

Charles

_______________________________________________

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: static analyzers says I'm leaking, I _think_ I'm not
      • From: Daniel Höpfl <email@hidden>
References: 
 >static analyzers says I'm leaking, I _think_ I'm not (From: Michael David Crawford <email@hidden>)
 >Re: static analyzers says I'm leaking, I _think_ I'm not (From: Daniel Höpfl <email@hidden>)

  • Prev by Date: Re: Help: NSScrollView is resizing its documentView down to (0, 0)
  • Next by Date: Re: Does the NSView Drag Protocol has any issues with non-key windows?
  • Previous by thread: Re: static analyzers says I'm leaking, I _think_ I'm not
  • Next by thread: Re: static analyzers says I'm leaking, I _think_ I'm not
  • Index(es):
    • Date
    • Thread