Skip navigation.
 
mlRe: Why does this leak memory?
FROM : j o a r
DATE : Sat Jan 18 23:04:44 2003

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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlWhy does this leak memory? Jamie Curmi Jan 18, 13:59
mlRe: Why does this leak memory? j o a r Jan 18, 17:50
mlRe: Why does this leak memory? Jamie Curmi Jan 18, 22:32
mlRe: Why does this leak memory? j o a r Jan 18, 23:04
mlRe: Why does this leak memory? j o a r Jan 18, 23:21
mlRe: Why does this leak memory? Jamie Curmi Jan 18, 23:27
mlRe: Why does this leak memory? j o a r Jan 19, 00:48
mlRe: Why does this leak memory? Andreas Mayer Jan 19, 01:23
mlRe: Why does this leak memory? j o a r Jan 19, 01:46
mlRe: Why does this leak memory? Jamie Curmi Jan 19, 02:04
mlRe: Why does this leak memory? j o a r Jan 19, 02:10
mlRe: Why does this leak memory? Jamie Curmi Jan 19, 04:27