Do you use D's GC?

max haughton maxhaton at gmail.com
Sun Aug 1 14:02:46 UTC 2021


On Sunday, 1 August 2021 at 08:54:05 UTC, Kirill wrote:
> It's interesting to hear do you use D's GC? Or do you use your 
> own custom memory management structure?
>
> How performant is GC?
>
> The reason I'm asking is I'm planning to dive into 3D game dev 
> with D as a hobby in an attempt to create a game I dreamed of 
> since I was a kid. I'd like to know if GC is worth using at 
> all, or should I go with 100% manual memory management.
>
> Any opinion is appreciated. Thanks in advance.

I use the GC. The GC is an extremely powerful tool for 
productivity. For a game your issue will be non-deterministic 
latency i.e. GC pauses. For this, I would recommend having a 
strategy for avoiding the GC - other people will write here and 
have written extensively before on how to do this, so I won't 
repeat all of those points and points to be. It may be worth a 
warning here: If you are going into a new field, you probably 
want to learn that field *then* try and do that field well rather 
than trying to learn how to make a good game engine and any game 
engine at the same time.

A small tip for any memory allocation: Before being clever and 
thinking about the internals of your memory allocator (which is 
important, to be clear), try to allocate less memory first - 
sounds simple but memory you never allocate has a cost of exactly 
zero.

Enjoy.


More information about the Digitalmars-d mailing list