Re: Leak in NSSavePanel
Re: Leak in NSSavePanel
- Subject: Re: Leak in NSSavePanel
- From: Corbin Dunn <email@hidden>
- Date: Wed, 25 Jun 2008 10:32:19 -0700
On Jun 24, 2008, at 3:55 PM, Jelle Vandebeeck wrote:
When I try to call the NSSavePanel, I always receive some memory
leaks on it. I have no idea if they are bad or not so bad... I just
can't find a decent tutorial on the Instruments tool.
Have you tried using the "leaks" tool in instruments? It is easy to
use. Keep the ref count, and look at the stack traces. Related, but
not what you want, is:
http://www.corbinstreehouse.com/blog/index.php/2007/10/instruments-on-leopard-how-to-debug-those-random-crashes-in-your-cocoa-app/
Walking through that tutorial will help you.
This is the code that generates the memory leak from time to time:
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setRequiredFileType:extention];
[savePanel setMessage:title];
[savePanel setExtensionHidden:YES];
It's the [NSSavePanel savePanel that gets the leak...
What do you mean by that?
Exactly what is leaking?
How are you determining it to leak?
I know the NSSavePanel is a singleton
No, it is not a singleton! Did you read this somewhere? If so, let me
know, so we can correct our documentation.
NOTE: Some things are cached.
, so it should always use the same instance. Is that the problem
when I try to call it multiple times in my application?
No, it isn't a problem, since it isn't a singleton. It creates a new
instance for you each time.
corbin
_______________________________________________
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