Do you use D's GC?
evilrat
evilrat666 at gmail.com
Sun Aug 1 14:43:47 UTC 2021
On Sunday, 1 August 2021 at 14:02:46 UTC, max haughton wrote:
> 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.
Just to add, from my rough tests it shows that you can have
unnoticeable collections for up to 300MB heap size depending on
CPU/RAM specs, after that there is clearly perceivable stutter
that drags FPS down esp. with loop allocations.
What this means in practice - it should be possible to go full
OOP crap for game simulation using lightweight classes without
any hiccups even with GC enabled, but all asset data should be
handled differently and taken out of GC scannable heap to avoid
long pauses.
But in reality one would probably choose another allocation
strategy that will probably accounts for disabling GC until
certain point later in time when collection pauses won't matter
and do manual collect there (on pause menu, respawn, level
change, etc...)
More information about the Digitalmars-d
mailing list