• 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: NSAutoreleasePool causes crashes when empty?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAutoreleasePool causes crashes when empty?


  • Subject: Re: NSAutoreleasePool causes crashes when empty?
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 3 Apr 2008 21:53:28 -0500

On Apr 3, 2008, at 9:05 PM, Kevin Dixon wrote:
Here's the contents of my thread's routine

{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

mEngine->Destretch(mAudioFileList, [uiOutputDirectory stringValue],

There's a good chance that [uiOutputDirectory stringValue] is actually putting something into the autorelease pool. So, no matter how little work mEngine->Destretch might be doing, the autorelease pool may not be empty.


smpteIndex);

[pool release];
[NSThread exit];

(NB: It is not strictly necessary to explicitly exit your threads. Falling out of the thread routine causes that to happen implicitly.)


}

In ->Destretch the only real allocation of Cocoa stuff is this
NSURL * url = [NSURL fileURLWithPath: filePath];
CFURLGetFSRef((CFURLRef)url, &output);

Does this need to be CFReleased some how?

No. The NSURL object is autoreleased. FSRefs are just opaque structs. I suspect "output" is on the stack, so you don't have to do anything special to deallocate it.



Its not very exciting, though since its objective-c++, maybe that's a factor. The stack trace looks like this:

0 objc_msgSend
1 ??
2 -[SFWindowController destretchWorkerThreadEntryPoint:]
3 forkTheadForFunction
4 _pthread_body

when I click on 2, it highlights the [pool release] line.

That _may_ indicate that the crash is actually happening on the line above. Sometimes the debugger indicates the next instruction that would execute after the inner frame returns.


However, what's more likely is that you have an invalid object in the autorelease pool. Try enabling NSZombie <http://developer.apple.com/ technotes/tn2004/tn2124.html#SECFOUNDATION>. That will get you helpful log messages.

Good luck,
Ken

_______________________________________________

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


References: 
 >NSAutoreleasePool causes crashes when empty? (From: "Kevin Dixon" <email@hidden>)
 >Re: NSAutoreleasePool causes crashes when empty? (From: John Stiles <email@hidden>)
 >Re: NSAutoreleasePool causes crashes when empty? (From: "Kevin Dixon" <email@hidden>)

  • Prev by Date: Re: Autorelease question
  • Next by Date: Image in NSPopupButtonCell
  • Previous by thread: Re: NSAutoreleasePool causes crashes when empty?
  • Next by thread: Re: NSAutoreleasePool causes crashes when empty?
  • Index(es):
    • Date
    • Thread