Do you use D's GC?
JN
666total at wp.pl
Sun Aug 1 09:56:48 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 think both approaches are viable. I am making a small 3D game
engine in D and I never had many issues with GC performance. In a
game, you shouldn't be allocating a lot of stuff on the heap
anyway. Most of big objects like buffers, textures should be
initialized once during startup anyway. Things like matrices and
vectors which you'll be using often are value types so they won't
be going through GC anyway.
Just avoid things like particle emitter having 10000 particles
which are GC-allocated whenever they spawn. Just make an
10000-sized array of particle structs and do the swap-with-last
then reduce count by 1 trick.
But if you want to go manual memory management, D will allow you
to do it.
More information about the Digitalmars-d
mailing list