Re: Why does this leak memory?
Re: Why does this leak memory?
- Subject: Re: Why does this leak memory?
- From: Bob Ippolito <email@hidden>
- Date: Sun, 10 Jul 2005 20:37:26 -1000
On Jul 10, 2005, at 8:28 PM, Matt Ball wrote:
I think I may be on to something...
I changed:
- (NSImage *)image
{
return [[image retain] autorelease];
}
to
- (NSImage *)image
{
return [image retain];
}
Neither of these are correct code. The first one isn't incorrect,
but it's like saying "return x + 1 - 1;". The second one leaks a
reference.
If this is a custom cell, perhaps you're not implementing NSCopying
and NSCoding? When you subclass something that implements protocols,
and make changes to it that break the implementation of those
protocols (adding ivars, etc.), then you are asking for it. ;)
-bob
_______________________________________________
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