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





On 4/2/06 10:44 AM, "Scott Ribe" <email@hidden> wrote:

>> I am obviously
>> doing something wrong so I guess it is time to go back and study the code
>> some more.
> 
> Does setGlass retain the string? Does your dealloc method properly release
> it?

Yes it does.  Here is my getter and setter methods:

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

- (void)setGlass:(NSString *)newGlass {
    if (glass != newGlass) {
        [glass release];
        glass = [newGlass copy];
    }
}

Bruce


 _______________________________________________
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: Scott Ribe <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.