[Gc] Crash with tiny static roots on darwin

Jim Hourihan jimhourihan at earthlink.net
Wed Jul 22 23:55:15 PDT 2009


On Jul 22, 2009, at 10:52 PM, Ivan Maidanski wrote:

> Hi!
>
> Jim Hourihan <jimhourihan at earthlink.net> wrote:
>>
>> Hi, I've been getting a crash during marking on darwin x86_64 if and
>> only if I link my app with a particular 3rd party framework.
>> ...
>>
>> Hacking GC_dyld_image_add() I noticed that this code will add
>> sections smaller than sizeof(void*). By preventing that behavior the
>> crashing has disappeared. (The framework in question had multiple  
>> tiny
>> sections). I'm wondering if this filter should be applied in
>> GC_add_roots_inner() since clearly no reference to GC memory can be
>> stored in anything less than pointer sized regions.
>
> Yes, I'll prepare patch for it (I think GC_remove_root() should be  
> improved for such cases too).
>
>>
>> Also, it looks like GC_register_has_static_roots_callback() is not
>> implemented at all for this platform and so I started to do so only  
>> to
>> become confused by its intended usage: the docs seem to indicate that
>> its called during each collection but it seems like it should be
>> called only when adding static roots initially.
>
> GC_register_dynamic_libraries() is called at (before) every  
> collection unless GC_no_dls is set. What makes you think it seems  
> like it should be called only when adding static roots initially  
> (and what is "initially"?).

By initially I mean at the time that they are first "discovered".

At least in the case of darwin, the information regarding the image  
associated with each segment is lost. Perhaps GC_dyld_image_add() is  
using the wrong function (GC_add_roots()).

With linux, it looks like the roots are added as temporary  
(GC_add_roots_inner()) depending on the result of GC_has_static_roots.  
Whereas on darwin they are added once permanently?

	-Jim




More information about the Gc mailing list