On Friday, February 23, 2018 01:54:07 Leonardo via Digitalmars-d-learn
> Hi, I'm new to language and games.
> Many people say that GC is bad and can slow down your project in
> some moments.
> What can happen if I create a game using D without worrying with
> memory management?
> (using full GC)
The GC won't slow down your code in general (in fact, it will probably speed
it up in comparison to reference counting), but whenever the GC does a
collection, that means that it stops all threads that it manages. So, you
could suddenly have everything stop for 100ms (the actual length of a
collection is going to depend on how much memory the GC has to scan, and I
don't know what the typical length of a collection is; that will depend on
the program). For programs that can afford to occasionally stop like that,
that's not a problem. For a game that's trying to maintain 60fps, that's
likely a really big deal.
There are a number of ways to handle it, though the biggest is to simply
minimize how much you allocate on the GC heap and how much memory has to be
scanned for pointers that refer to GC-allocated memory. Other stuff includes
disabling the GC while critical pieces of code are running and having
critical threads not be managed by the GC or use GC-allocated memory.
I would suggest that you read this series of articles on the official D
- Jonathan M Davis