Game and GC

Mike Franklin slavo5150 at yahoo.com
Fri Feb 23 02:44:22 UTC 2018


On Friday, 23 February 2018 at 01:54:07 UTC, Leonardo wrote:
> 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)

Don't let the GC prevent you from writing a game in D.  D is the 
most flexible language I have ever used; you just need to learn 
how to deal with the GC in your game.

Jonathan M. Davis gave you some good advice and explained the 
fundamental problem with the GC in real time games (the potential 
for pauses during reclamation).  You can avoid that in a number 
of ways like temporarily disabling the GC during the real-time 
part of your game, just to name one.  More can be found in the 
resources below.

https://wiki.dlang.org/Memory_Management
http://p0nce.github.io/d-idioms/#The-impossible-real-time-thread

automem (https://github.com/atilaneves/automem) also gives you 
reference counting in D (C++ style), if that will work better for 
your use case.

Mike


More information about the Digitalmars-d-learn mailing list