• 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: Tom Davie <email@hidden>
  • Date: Thu, 12 Sep 2013 18:23:11 +0200

On 12 Sep 2013, at 18:15, Daniel Höpfl <email@hidden> wrote:

> On 2013-09-12 17:52, Graham Cox wrote:
>> I believe it does. I think your reading of the getter convention may
>> be incorrect. If you can point to explicit documentation that states
>> that the returned object must belong to an autorelease pool, I'll
>> stand corrected, but that would be the first time I've ever heard that
>> in 13 years of Cocoa programming!
>
> Even if there is such a rule:
>
> - (id) eventTypes
> {
>    // [self lazyInitEventTypes];
>
>    return [[mEventTypes retain] autorelease];
> }

It’s not a hard and fast rule, and in fact collection access does not do this, so it’s entirely possible to do things like:

id a = x[5];
[x removeObjectAtIndex:5];
[a crashMyProgram];

Tom Davie
_______________________________________________

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


References: 
 >Fwd: Analyser reports memory leak… where? (From: Bill Cheeseman <email@hidden>)
 >Re: Analyser reports memory leak… where? (From: Roland King <email@hidden>)
 >Re: Analyser reports memory leak… where? (From: Bill Cheeseman <email@hidden>)
 >Re: Analyser reports memory leak… where? (From: Graham Cox <email@hidden>)
 >Re: Analyser reports memory leak… where? (From: Bill Cheeseman <email@hidden>)
 >Re: Analyser reports memory leak… where? (From: Graham Cox <email@hidden>)
 >Re: Analyser reports memory leak… where? (From: Daniel Höpfl <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