• 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
Thread not registered mystery under GC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Thread not registered mystery under GC


  • Subject: Thread not registered mystery under GC
  • From: Andy O'Meara <email@hidden>
  • Date: Mon, 25 Oct 2010 16:22:05 -0500

Hey guys, hopefully someone who knows what may be going under the pthread/NSThread hood when GC is enabled can solve this little mystery...

Pretty straightforward situation: I have a 64 bit Cocoa app (and screen saver) that uses pthreads (via the pthread API, *not* NSThread).  To be compatible with GC with IAW with Apple's GC Programming Guide (quote below), I make a call to [NSThread currentThread] when a new thread starts so that it gets registered with the GC subsystem.

Per Apple GC Programming Guide (page 15):

// SNIP //

Garbage collection is performed on its own thread--a thread is explicitly registered with the collector if it calls NSThread's currentThread method (or if it uses an autorelease pool). There is no other explicit API for registering a pthread with the collector.

// SNIP //

However when my bundle runs under as a 64 bit GC app or a 64 bit screen saver (via the sys prefs app), the following log msg shows up for each call to [NSThread currentThread] I make when the thread first starts:

[0x0-0x8b08b0].com.apple.systempreferences[1198]	System Preferences(1198,0x11a8f9000) malloc: *** auto malloc[1198]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug.

As the message directs, I set that breakpoint, and I see the following stack inside of the [NSThread currentThread] call:

#0	0x7fff81b08c64 in auto_zone_thread_registration_error
#1	0x7fff81b089aa in Auto::Zone::registered_thread
#2	0x7fff81b01df0 in auto_zone_allocate_object
#3	0x7fff85c8602a in _internal_class_createInstanceFromZone
#4	0x7fff866d56e9 in +[NSObject(NSObject) allocWithZone:]
#5	0x7fff866d5671 in +[NSObject(NSObject) new]
#6	0x7fff88e553b5 in _NSThreadGet0

So, it seems like I'm following the spec yet I can't seem to shake that error message.  Anyone on the inside care to illuminate what's happening here?  Apart from those [NSThread currentThread] calls I make when the pthread first starts, is there something else I need to call that the GC spec doesn't discuss?

Thanks in advance!

Andy




_______________________________________________

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: Thread not registered mystery under GC
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: Re: [NSImage] Bug in System Preferences? [solved]
  • Next by Date: Drag and drop between two table views.
  • Previous by thread: HTTPS problem
  • Next by thread: Re: Thread not registered mystery under GC
  • Index(es):
    • Date
    • Thread