• 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: Fixing a leak in an NSFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fixing a leak in an NSFormatter


  • Subject: Re: Fixing a leak in an NSFormatter
  • From: Darrin Cardani <email@hidden>
  • Date: Wed, 7 Apr 2004 17:16:02 -0500

At 11:46 PM +0200 4/7/04, Ondra Cada wrote:
Perhaps then the crasher bug would bite your back ;)

It is actually pretty probable, for NSAttributedString would copy the string, for an immutable string copy means a retain, so the string of yours is kept alive by the leaker attributed string. If you remove the leak, the "regular" string goes too--since it was released once too many.

Yes, that's exactly what was happening. I guess I didn't realize that a leak could cover a double dispose in that way. But the above explanation makes it clear why. I think I would have been better off it had just crashed originally! :-)

Thanks to everyone who helped!

Now I'm working on another leak that's a little weirder. The app prompts the user for a QuickTime movie. It uses an NSOpenPanel and calls +[ NSOpenPanel openPanel ].

The 'leaks' command is telling me there's a leak when calling this function. It gives me the following stack trace:

main
NSApplicationMain
-[NSApplication run]
-[NSApplication sendEvent:]
-[NSApplication _handleKeyEquivalent:]
-[NSMenu performKeyEquivalent:]
-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:]
-[NSMenu performActionForItemAtIndex:]
-[NSApplication sendAction:to:from:]
-[MyDocument importMovie:]
+[NSSavePanel _crunchyRawUnbonedPanel]
-[NSSavePanel initWithContentRect:styleMask:backing:defer:]
-[NSSavePanel _initPanelCommon]
-[NSSavePanel _initSidebarAndPopups]
+[NSNavFBENode sidebarContainerNodes]
GetVirtualNode
TNode::GetVirtualNode(unsigned long)
TNode::GetVolumesNode()
TNode::PopulateVirtualContainerFromSFL(OpaqueSFLRef*)
TNode::CreateVirtualAliasRecord(OpaqueSFLItemRef*, TNodePtr&,
VirtualAliasRecord*&, bool&, bool&, bool&)
TNode::GetIconRefForProxy() const
THFSPlusRef::ReadIconRefForProxy(OpaqueIconRef*&) const
TMetaData::ReadIconRefForProxy(OpaqueIconRef*&) const
GetIconRefFromFileInfo
GetImageForFSItem
ISBuildBaseImage(FSRef const*, HFSUniStr255 const*, unsigned long*, FSCatalogInfo*, CustomBadgeResource*, unsigned long, unsigned char*)
GetFolderType(FSRef const*, short, long, long, HFSUniStr255 const*, unsigned
char, unsigned char)
FindFolder
FindFolderGuts
GetInternalFolderDesc
FindClassicDomainFolderDesc
IsClassicFolderRedirectionEnabled
DetermineClassicFolderRedirectionStatus
MyCFPreferencesCopyValueNoCache
_CFPreferencesURLForManagedDomain
CFStringCreateWithFormat
_CFStringCreateWithFormatAndArgumentsAux
CFStringCreateCopy
__CFStringCreateImmutableFunnel3
_CFRuntimeCreateInstance
malloc_zone_malloc

I assume +[NSSavePanel _crunchyRawUnbonedPanel] is just an internal name for [ NSOpenPanel openPanel ], right? Is this a "false" leak since NSOpenPanel creates the open panel on the first call, then recycles it?

Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
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: Fixing a leak in an NSFormatter
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Fixing a leak in an NSFormatter (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Thread-related crash
  • Next by Date: Re: Fixing a leak in an NSFormatter
  • Previous by thread: Re: Fixing a leak in an NSFormatter
  • Next by thread: Re: Fixing a leak in an NSFormatter
  • Index(es):
    • Date
    • Thread