Re: Why does this leak memory?
Re: Why does this leak memory?
- Subject: Re: Why does this leak memory?
- From: j o a r <email@hidden>
- Date: Sat, 18 Jan 2003 23:04:44 +0100
May I ask why you copy the item created in the first place? Why don't
you simple:
[[NSImage imageNamed:@"Connected"] retain];
...if you want to keep the image created? By doing it the way you wrote
in the first message, you'll immediately loose all references to the
created image - and thus "leaking" it until it gets autoreleased - and
only keep a reference to the copy.
It's not clear from your messages that you have understood the concept
of reference counting and aboutorelease pools? Is that the problem, or
is it really something else?
j o a r
On Saturday, Jan 18, 2003, at 22:32 Europe/Stockholm, Jamie Curmi wrote:
I should point out, every time this is called, more leaks occur. It
isn't just the first call of [NSImage imageNamed:@"Connected"] that
leaks (I realise that gets cached). It appears that every call of
copy, followed by the release, ends up with more memory leaked.
MallocDebug shows the leak - and it increases with each call.
Similarly "top" shows the vsize increasing with each call.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.