GC, the simple solution

David Gileadi foo at bar.com
Fri Jun 9 10:28:36 PDT 2006


Walter Bright wrote:
> Jeff Parsons wrote:
>> My _only_ significant beef with D so far as been the unbound time for 
>> a garbage collection; therefore, if an incremental garbage collector 
>> built into D could guarantee me a set maximum time would be taken for 
>> each garbage collection (which I would manually induce as often as 
>> possible) then unless the efficiency hit is TERRIBLE I would be all 
>> over it.
> 
> If you're looking for a *guarantee*, then you cannot even use malloc(). 
> Malloc has unbounded time, and is not predictable.

It seems that a fairly common desire is to use D for writing games. 
Games don't typically have hard real-time requirements, but it also 
doesn't look good if your screen freezes for a second or two in the 
middle of play.

This is an area where an incremental collector or some kind of reference 
counting solution would be handy, since (especially in large programs) 
it would be difficult to avoid using garbage collected code.  I realize 
that the programmer has the responsibility to manage memory 
intelligently, but it would be nice to not avoid using GC code entirely. 
  As others have stated, it would even be worth giving up some overall 
performance to gain a smooth playing experience.



More information about the Digitalmars-d mailing list