Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String memory leak



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: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: String memory leak (From: Bruce Truax <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.