• 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: String memory leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String memory leak


  • Subject: Re: String memory leak
  • From: Paul Forgey <email@hidden>
  • Date: Sun, 2 Apr 2006 17:26:02 -0700

I'm not certain why the accessor is retaining it and then adding that count to the autorelease pool. If the caller wants an instance of the glass string beyond the lifetime of the class instance owning it or it being changed, it should retain it itself. So why not:

- (NSString *)glass
{
    return glass;
}

But check you have something like:

- (void)dealloc
{
    [glass release];
    [super dealloc];
}


On Apr 2, 2006, at 6:10 PM, Bruce Truax wrote:

- (NSString *)glass {
    return [[glass retain] autorelease];
}

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: String memory leak
      • From: Ondra Cada <email@hidden>
References: 
 >Re: String memory leak (From: Bruce Truax <email@hidden>)

  • Prev by Date: Re: String memory leak
  • Next by Date: Making an iTunes style bar
  • Previous by thread: Re: String memory leak
  • Next by thread: Re: String memory leak
  • Index(es):
    • Date
    • Thread