[Dlang-internal] Concurrent No-Pause GC Option (idea)

frame frame86 at live.com
Sun Aug 21 17:10:19 UTC 2022


On Sunday, 21 August 2022 at 00:11:55 UTC, jordan4ibanez wrote:

> This is coming from someone new to D and I am still learning 
> much about it and trying to help build the ecosystem and 
> languages as much as I can. I would love to know your thoughts.

You probably thinking of RC: (Ref(erence) Counted) GC, where 
memory can be collected if the last reference is gone.

The drawbacks of this approach are that you will need more memory 
for each allocated variable since you will need to track the 
references. And to increase or decrease those reference counts 
has a runtime impact whereever a reference occurs: eg. pointer to 
`data` is passed to another object and the original pointer is 
going out of scope. Or just a common slice (`[]`) as seen in 
`string` that is handled from function to function maybe even 
recursively.

The current GC doesn't do this, keeping the impact low. It only 
needs to stop the threads if it need to collect in a cycle which 
doesn't always happen and you can even help organize the GC's 
cleanup work by manually calling `GC.collect()` when it's only 
suitable for your program.

If you are interested in this stuff, I suggest you to dig in the 
General forum section where cons & pros of other GC 
implementations and their side effects are heavily discussed :D


More information about the Dlang-internal mailing list