• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why does this leak memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Why does this leak memory?
      • From: Jamie Curmi <email@hidden>
    • Re: Why does this leak memory?
      • From: j o a r <email@hidden>
References: 
 >Re: Why does this leak memory? (From: Jamie Curmi <email@hidden>)

  • Prev by Date: Re: Spinner not working in PB
  • Next by Date: Re: implementing pop up menus
  • Previous by thread: Re: Why does this leak memory?
  • Next by thread: Re: Why does this leak memory?
  • Index(es):
    • Date
    • Thread