Am 18.02.2013 16:08, schrieb Sergei Nosov:
On Monday, 18 February 2013 at 10:35:59 UTC, Benjamin Thaut wrote:
I wen't down this path already and I ended up not using the GC at all:

http://3d.benjamin-thaut.de/?p=20

http://dlang.org/garbage.html has a list of features that rely on GC and
I would say everything in this list is something you cannot (simply) do
without dynamic allocation.

And as far as I'm concerned, you don't want to use even dynamic
allocation in a game due to real-time constraints, since any dynamic
allocation is non-deterministic. I don't know any "serious" project that
doesn't use pre-allocation and stuff.

Well games are only soft-realtime. So you can afford having dynamic allocations. But you are correct. For dynamic allocations it is usually tried to use custom allocators which are backed by preallocated memory blocks. But still its a lot less of a problem to use malloc a free on a even during the simulation compared to a stop the world mark & sweep.


Do I understand it correctly, that you pointed out the parts in
druntime/phobos that "overrely" on GC (could be done without it, but
done otherwise)?

Yes correct. But if you would do them otherwise you wouldn't need a GC in the first place. The whole point of the GC is that you can be more productive by not caring about this stuff.


Cause if not - avoiding everything from that list should make GC present
almost unnoticeable. And that's what you want to do anyways, whether GC
is present or not, if you're really targeting real-time.

Correct. Still I rather have a system that gives me errors when I make hidden runtime allocations then having the GC clean them up for me. Coding by convetion never works out well, especially in lager teams.

Kind Regards
Benjamin Thaut

Reply via email to