• 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
My bug or Apple's?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

My bug or Apple's?


  • Subject: My bug or Apple's?
  • From: John Stiles <email@hidden>
  • Date: Thu, 11 Nov 2004 18:49:51 -0800

I have an app that attempts to free all its resources during the shutdown phase. Some of this happens from C++ static destructors.
I've found one minor glitch. I have a cache of NSImage objects; I call [image release] on each one to free it. I noticed this string was appearing in my console several times:


2004-11-11 18:41:36.472 MyApp (Debug)[607] *** _NSAutoreleaseNoPool(): Object 0x477a90 of class NSImageCacheView autoreleased with no pool in place - just leaking

So I checked my code and I'm not using autorelease--which I shouldn't, because at this point in time the autorelease pool is probably long gone. I'm just doing a plain-vanilla:

		~ImageEntry() { [image release]; }

However, I stopped it in GDB and it looks like part of the image's release function is autoreleasing on something else. Here's a stack crawl:

Breakpoint 1, 0x90a74aac in NSLog ()
(gdb) bt
#0 0x90a74aac in NSLog ()
#1 0x909f22cc in -[NSObject autorelease] ()
#2 0x92df7294 in -[NSView _removeSubview:] ()
#3 0x92dea5b0 in -[NSView _setSuperview:] ()
#4 0x92dec668 in -[NSView removeFromSuperview] ()
#5 0x92e538ec in -[NSView removeFromSuperviewWithoutNeedingDisplay] ()
#6 0x9019f194 in CFArrayApplyFunction ()
#7 0x92de576c in -[NSView _finalize] ()
#8 0x92e1e3e4 in -[NSView dealloc] ()
#9 0x92ecda04 in -[NSNextStepFrame dealloc] ()
#10 0x92dc67fc in -[NSView release] ()
#11 0x92e133b4 in -[NSWindow dealloc] ()
#12 0x92e652c0 in _NXFreeImageCache ()
#13 0x92e2f4c4 in -[NSCachedImageRep dealloc] ()
#14 0x92e129d0 in -[NSImage _freeRepresentation:] ()
#15 0x92e27118 in -[NSImage dealloc] ()
#16 0x00101f8c in TSHashTable<ImageEntry>::InternalDelete(ImageEntry*) ()
#17 0x00107cf8 in TSHashTable<ImageEntry>::InternalClear(int) ()
#18 0x001020cc in TSHashTable<ImageEntry>::~TSHashTable() ()
#19 0x000dff10 in __destroy_global_chain ()
#20 0x9002c7b8 in exit ()
#21 0x92eadb9c in -[NSApplication terminate:] ()
#22 0x00004e2c in Quit() ()


So what's the best solution here?
(a) Wrap this destructor with an autorelease pool
(b) Find a way to release the NSImages before exit() is called
(c) File a bug with Apple, since they are assuming an autorelease pool exists


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: My bug or Apple's?
      • From: "John C. Randolph" <email@hidden>
    • Re: My bug or Apple's?
      • From: "John C. Randolph" <email@hidden>
    • Re: My bug or Apple's?
      • From: John Stiles <email@hidden>
    • Re: My bug or Apple's?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Bindings and localization
  • Next by Date: Custom palette questions
  • Previous by thread: Re: objc_method_list structure?
  • Next by thread: Re: My bug or Apple's?
  • Index(es):
    • Date
    • Thread