draft proposal for ref counting in D

Sean Kelly sean at invisibleduck.org
Thu Oct 17 10:10:59 PDT 2013


On Oct 16, 2013, at 1:05 PM, Benjamin Thaut <code at benjamin-thaut.de> wrote:
> 
> Am 16.10.2013 21:05, schrieb Sean Kelly:
>> On Oct 16, 2013, at 11:54 AM, Benjamin Thaut <code at benjamin-thaut.de> wrote:
>>> 
>>> The problem is not that there are no GCs around in other languages which satisfy certain requirements. The problem is actually implementing them in D. I suggest that you read "The Garbage Collection Handbook" which explains this in deep detail. I'm currently reading it, and I might write an article about the entire D GC issue once I'm done with it.
>> 
>> I think the short version is that D being able to directly call C code is a huge problem here.  Incremental GCs all rely on the GC being notified when pointers are changed.  We might be able to manage it for SafeD, but then SafeD would basically be its own language.
> 
> I think a even bigger problem are structs. Because if you need write barriers for pointers on the heap you are going to have a problem with structs. Because you will never know if they are located on the heap or the stack. Additionally making the stack percisely scannable and adding GC-Points will require a lot of compiler support. And even if this is doable in respect to DMD its going to be a big problem for GDC or LDC to change the codegen.

Yes, any pointer anywhere. I recall someone posting a doc about a compromise solution a few years back, but I'd have to do some digging to figure out what the approach was. 


More information about the Digitalmars-d mailing list