What's the go with the GC these days?

Walter Bright newshound2 at digitalmars.com
Sun Jan 6 03:42:05 UTC 2019


On 1/5/2019 2:05 PM, Manu wrote:
> How much truth is in here?

There's a lot of triggering on the word "GC". At some level, it doesn't matter 
how good or bad the GC is, it's "GC is bad". Even if your code never calls the GC.


> What is this business about write barriers making the GC fast? Is that
> actually fact, or are there other hurdles?

Here's an explanation:

https://stackoverflow.com/questions/19154607/how-actually-card-table-and-writer-barrier-works

There are many more if you google "gc write barrier".

The penalty, of course, is extra code gets run for every write through a pointer.

The benefits exceed the penalties for a language where all dynamic allocation is 
done via the GC. But for D, where quite a lot of it is not, it isn't so clear. 
What is clear is that if you're going to compare speed with C++, having those 
write barriers in there is going to be a serious penalty, because they'll be 
there even if you don't use the GC.

 > Where's the ARC stuff? What happened to opAddRef/opRelease?

Andrei, Razvan, and I have decided that the most pragmatic way forward to 
support reference counting is to support copy constructors ala C++. C++ is 
clearly successful with this approach, and Andrei/Razvan concluded that D's 
postblit just doesn't cut it. Razvan has a proposal for copy constructors, and 
an implementation PR that has fallen a bit behind his latest proposal.


More information about the Digitalmars-d mailing list