The GC (agian)

JG someone at somewhere.com
Sat Nov 20 13:48:44 UTC 2021


Hi,

Having been hanging around these forums for a few years now (and 
writing software in D during that time) I have noticed that there 
are quite often disagreements about the GC.

I was thinking about this and wondered if some of these problems 
could be possibly
eliminated by making the GC more configurable. For instance one 
might envisage
that one can with some nice API be able do things like:
(a) specify exactly when the GC should do a stop the world mark 
and sweep (not when it feels like it when it needs to allocate 
memory and perhaps through an API more pleasant than the current, 
enable and disable mechanism);
(b) specify that the next allocations should be done into a 
preallocated block (which it could be asked to drop later, 
without marking and sweeping).

I guess my real question is more is there someway that the GC be 
modified so that on the one hand it works exactly like it does 
now (if no options are set) and on the other hand can be 
configured so that it is close enough to manual memory allocation 
that say someone building a game wouldn't find it gets in there 
way.

The main point would be to allow someone to fully use D (with 
some extra house-keeping they have to do) but avoid unpredictable 
GC pauses.

I understand that this wouldn't satisfy everyone, but perhaps it 
would be more feasible than some of the more drastic proposals 
that get thrown around from time to time.

If this is something that makes sense and would be useful I would 
be willing to try and build it.

[In case it is of interest to anyone, personally I like having a 
GC, although there are a few instances where it would be nice to 
have a bit more flexibility.]


More information about the Digitalmars-d mailing list