Incremental garbage collection

Ola Fosheim Grøstad ola.fosheim.grostad at
Fri Jan 21 12:26:42 UTC 2022

On Friday, 21 January 2022 at 10:13:17 UTC, Elronnd wrote:
> On Friday, 21 January 2022 at 10:00:17 UTC, IGotD- wrote:
>> The problem is that D as no managed pointers.
> Again, this can be solved conservatively at the 
> implementation-level.

It could, in theory, if you change the semantics of @nogc and 
annotate everything with @nogc that the collector must leave 
alone. I suspect that some of the existing @nogc code would have 
to be rewritten. But this approach is very close to introducing a 
new pointer type.

You also need to prevent scannable pointers to be available 
through unions, so a breaking language change is practically 
unavoidable if you want to make a good GC collector for the 

There is also no way for D to force barriers on linked code, 
hence the need for a breaking language level change at some level.

(I assume many approaches are possible, but all require a 
breaking change).

More information about the Digitalmars-d mailing list