Re: Instruments leaks.
Re: Instruments leaks.
- Subject: Re: Instruments leaks.
- From: Fritz Anderson <email@hidden>
- Date: Sun, 12 Oct 2008 09:35:38 -0500
On 11 Oct 2008, at 11:31 PM, Sandro Noel wrote:
for instance, the leek tells me that i have a leek here in this
functions.
it is a NSString categorie.
- (NSString *) trimWhiteSpace {
NSMutableString *s = [[self mutableCopy] autorelease];
CFStringTrimWhitespace ((CFMutableStringRef) s);
return (NSString *) [[s copy] autorelease];
} /*trimWhiteSpace*/
and the way the function is being used is like this.
description = [description trimWhiteSpace];
i'm still looking into understanding, so it's kind of hard for me to
be more precise, i'm sorry...
The question is then what happens to the "description" pointer later.
Suppose "description" is an instance variable. Do you later retain/
copy it? When you make the assignment you show, into "description," do
you first release/autorelease the old value (if you had retained/
copied/alloced it)?
It's that sort of history, of what you do later with the pointer, that
determines whether the pointer has been leaked.
Another thought: It appears you are not using garbage collection, but
are you? I understand -- someone please correct me -- Instruments/
Leaks is not accurate under GC.
By the way, the word you want is "leak." A "leek" is a vegetable.
— F
--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- <http://x3u.manoverboard.org/
>
_______________________________________________
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