• 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: Leak in NSSavePanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Leak in NSSavePanel


  • Subject: Re: Leak in NSSavePanel
  • From: Jelle Vandebeeck <email@hidden>
  • Date: Fri, 27 Jun 2008 00:23:10 +0200

Hi Corbin,

You should check out this link: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/Reference/Reference.html

The word singleton is used :-)

But I thought [NSSavePanel savePanel] returned an autoreleased object, so I presumed no leaks could occur...

-- Jelle

On 25 Jun 2008, at 19:32, Corbin Dunn wrote:

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


  • Follow-Ups:
    • Re: Leak in NSSavePanel
      • From: Corbin Dunn <email@hidden>
    • Re: Leak in NSSavePanel
      • From: Andy Lee <email@hidden>
References: 
 >Leak in NSSavePanel (From: Jelle Vandebeeck <email@hidden>)
 >Re: Leak in NSSavePanel (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
  • Next by Date: Re: Leak in NSSavePanel
  • Previous by thread: Re: Leak in NSSavePanel
  • Next by thread: Re: Leak in NSSavePanel
  • Index(es):
    • Date
    • Thread