On Saturday, June 01, 2013 09:43:49 bearophile wrote: > > - GC runs at unpredictable moments > > Is this true? I think the D GC runs only when you allocate > something.
Sure, but which of these calls to new is going to cause the GC to run? auto a = new Foo; ... auto b = new Bar; ... auto c = new Baz; It could be that all or none of them do. It all depends on what memory is available at the time and what exactly they're trying to allocate. So, while you may be able to know that the GC will only run when new is called, you don't know which new will trigger it, and it can (and probably will) vary on each run of the program. Pretty much the only way to control it is to disable the GC and then explicitly do a collection when you can afford a collection to run (though in a program like those Manu typically writes, where you're generating something like 60 frames per second, the GC is pretty much never fast enough to be run - not with anything even vaguely like it's current implementation). - Jonathan M Davis
