new D2.0 + C++ language

Christopher Wright dhasenan at gmail.com
Sat Mar 21 06:05:58 PDT 2009


Rainer Deyke wrote:
> Christopher Wright wrote:
>> I was pulling numbers out of my ass.
> 
> That's what I assumed.  I'm a game developer.  I use GC.
> 
>> 0.1 seconds out of every ten is a small amount to pay for the benefits
>> of garbage collection in most situations.
> 
> GC is useless for resource management.  RAII solves the resource
> management problem, in C++ and D2.  GC is a performance optimization on
> top of that.  If the GC isn't faster than simple reference counting,
> then it serves no purpose, because you could use RAII with reference
> counting for the same effect.
> 
> (No, I don't consider circular references a problem worth discussing.)

I believe Python is using reference counting with a garbage collector, 
with the collector intended to solve the circular reference problem, so 
apparently Guido van Rossum thinks it's a problem worth discussing.

And my opinion of reference counting is, if it requires no programmer 
intervention, it's just another garbage collector. Reference counting 
would probably be a win overall if a reference count going to zero would 
only optionally trigger a collection -- you're eliminating the 'mark' 
out of 'mark and sweep'. Though I would still demand a full 
mark-and-sweep, just not as often. Nontrivial data structures nearly 
always have circular references.



More information about the Digitalmars-d mailing list