• 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: Analyser reports memory leak… where?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Analyser reports memory leak… where?


  • Subject: Re: Analyser reports memory leak… where?
  • From: Simone Tellini <email@hidden>
  • Date: Thu, 12 Sep 2013 12:20:40 +0200

I hate it when Thunderbird manages to throw away the content of the mails I send to the list! Let's try again...

Il giorno 12/set/2013, alle ore 11:35, Graham Cox <email@hidden> ha scritto:

> Here's some code for which the Analyser reports "potential leak of an object stored into 'eventTypes'". I don't see it.
>
> I didn't write this code, so I'm reluctant to change it even though I would have written it a bit differently. mEventTypes is an ivar.
>
> - (void)setEventTypes:(NSDictionary*)eventTypes
> {
>    if (eventTypes != mEventTypes)
>    {
>        [mEventTypes release];
>        mEventTypes = [eventTypes retain];
>    }
>    InitializePrefsForEventTypeNames();
> }
>
> - (NSDictionary*)eventTypes
> {
>    if (mEventTypes == nil)
>    {
>        [self loadNib];
>
>        NSDictionary* eventTypes = [self newEventTypes];
>        [self setEventTypes:eventTypes];
>        [eventTypes release];
>    }
>
>    return mEventTypes;    //<----- analyser complains here
> }
>

is there a [mEventTypes release] in -dealloc?

Otherwise, this might be the "potential" problem it complains about: -eventTypes can create a new object which never goes away (since its name doesn't imply a +1 return, the caller is not supposed to release it).

--
Simone Tellini
http://tellini.info/
_______________________________________________

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: Analyser reports memory leak… where?
      • From: Graham Cox <email@hidden>
References: 
 >Analyser reports memory leak… where? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Analyser reports memory leak… where?
  • Next by Date: Re: Analyser reports memory leak… where?
  • Previous by thread: Re: Analyser reports memory leak… where?
  • Next by thread: Re: Analyser reports memory leak… where?
  • Index(es):
    • Date
    • Thread