About RAII and GC...?

Robert Fraser fraserofthenight at gmail.com
Mon Jul 30 18:11:31 PDT 2007


Nick Sabalausky Wrote:

> Maybe I'm misunderstanding things, but if you use RAII wherever appropriate, wouldn't that eliminate the need for garbage collection? Is there something I'm missing here?

If the only resource you're acquiring at construction is memory (90% of cases), you can just use the GC instead. Also, the GC isn't necessarily incompatible with RAII -- if there's some resource you don't need to release as soon as possible, the GC will run the destructor on its own.



More information about the Digitalmars-d mailing list