The "no gc" crowd

Sean Kelly sean at invisibleduck.org
Wed Oct 9 06:51:02 PDT 2013


On Oct 9, 2013, at 4:30 AM, Jacob Carlborg <doob at me.com> wrote:
> 
>> On 2013-10-09 05:31, Walter Bright wrote:
>> 
>> Making this work is fraught with difficulty. It is normal behavior in D
>> to create local data with new(), build a data structure, and then cast
>> it to shared so it can be transferred to another thread. This will fail
>> miserably if the data is allocated on a thread local heap.
> 
> I agree with Andrei here. Alternatively perhaps the runtime can move the data to a global pool if it's casted to shared.

Generally not, since even D's precise GC is partially conservative.  It's also way more expensive than any cast should be. For better or worse, I think being able to cast data to shared means that we can't have thread-local pools. Unless a new attribute were introduced like "local" that couldn't ever be cast to shared, and that sounds like a disaster. 


More information about the Digitalmars-d mailing list