Hard-to-reproduce GC bug

Steven Schveighoffer schveiguy at yahoo.com
Fri Dec 5 08:43:04 PST 2008


"dsimcha" wrote
> == Quote from Sean Kelly (sean at invisibleduck.org)'s article
>> Weird.  The actual storage for TLS in druntime is an array of void*
>> within the Thread class.  I can't imagine that it wouldn't be scanned by
>> the GC.  Do you have a reproducible test case?
>> Sean
>
> I just now managed to play around with this some more and come up with a 
> small
> test case, as opposed to a much larger real-world case, that reproduces 
> this.  I
> still haven't the slightest clue *why* my latest test case reproduces the 
> bug and
> some others that I had tried didn't, but I've filed a bug report.  See:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=2491

I don't know if that __thread keyword is fleshed out yet.  There is no 
documentation on it in the spec.  The only place it is referenced is in the 
changelog, and there it says: "This is for testing purposes only to check 
out the machinery in the back end."

I'd say most likely that the GC doesn't see anything declared as __thread, 
so when you use that pointer as the only reference to GC allocated data, it 
doesn't see that it's still in use, and will collect.

-Steve 





More information about the Digitalmars-d mailing list