Re: Instruments leaks.
Re: Instruments leaks.
- Subject: Re: Instruments leaks.
- From: j o a r <email@hidden>
- Date: Sat, 11 Oct 2008 22:07:34 -0700
On Oct 11, 2008, at 9:31 PM, Sandro Noel wrote:
for instance, the leek tells me that i have a leek here in this
functions.
So this is actually not really true. What leaks will initially tell
you is where the leaked object was created. That's not the same thing
as where that object was leaked. Leaks can't tell you exactly where
the object was leaked, unfortunately. What it can tell you though, is
all the places where the object was retained & released (and
autoreleased). Using this information, you can typically figure out
where you retained some object when you shouldn't have, creating a leak.
Example:
- (NSString *) giveMeAString {
// String created here. No memory management error at this point.
return [NSString stringWithString: @"A String"];
}
- (void) someMethod {
NSString *aString = [self giveMeAString];
[aString retain]; // String retained here, but never subsequently
released. This is a leak!
}
Notice how the string is created in one place, but how the actual
memory management error that leaks that object happens elsewhere.
j o a r
_______________________________________________
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