The GC (agian)
Commander Zot
no at no.no
Sat Nov 20 15:34:11 UTC 2021
On Saturday, 20 November 2021 at 13:48:44 UTC, JG wrote:
> 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.]
If you want manual memory management you can do that today.
If you don't want the GC to stop the world you can create a
thread not registered to to GC today.
Yes, you lose access to some language features that require
automatic memory management.
But that is not that big of a deal when other languages like
C/C++ don't even have those in the first place.
I'm all for improving the GC and providing more options, but IMHO
there are more important things where your help could have a
bigger impact on D usability.
More information about the Digitalmars-d
mailing list