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

Re: Thread not registered mystery under GC


  • Subject: Re: Thread not registered mystery under GC
  • From: Andy O'Meara <email@hidden>
  • Date: Tue, 26 Oct 2010 14:32:43 -0500

Thanks for your help, Bill -- your suggestion (plus an extern "C" declaration) causes the error to go away!

Radar filed -- 8595912

Many Thanks,
Andy

P.S.  It's in the radar, but the doc URL is http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/GarbageCollection/GarbageCollection.pdf -- under the topic "Threading" (or search the pdf for "register").


On Oct 25, 2010, at 5:19 PM, Bill Bumgarner wrote:

>
> On Oct 25, 2010, at 2:22 PM, Andy O'Meara wrote:
>
>> 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 //
>
> That'd be a bug;  please file via http://bugreport.apple.com/ and provide an URL to the document.
>
>> 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?
>
> Yes.  Call objc_registerThreadWithCollector() from the thread.
>
> The behavior was changed because folks were surprised to see the collector being registered on their thread when they were "only" using Core Foundation code and "no Objective-C".   Core Foundation is actually implemented using a growing chunk of Objective-C code.   Thus, the collector became noisy about this so people wouldn't be surprised -- or, more importantly, would be surprised but would figure out what is up more quickly.
>
> That document is wrong.
>
> b.bum

_______________________________________________

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: 
 >Thread not registered mystery under GC (From: Andy O'Meara <email@hidden>)
 >Re: Thread not registered mystery under GC (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Make NSTextField register changes immediately
  • Next by Date: Re: Thread not registered mystery under GC
  • Previous by thread: Re: Thread not registered mystery under GC
  • Next by thread: Re: Thread not registered mystery under GC
  • Index(es):
    • Date
    • Thread