How to get to 100% precise tracing GC?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Nov 12 08:43:40 UTC 2020


What restrictions have to be made to make the GC 100% precise?

I am aware of:
- unions
- owning void* pointers?

Would it be sufficient to:

1. ban void-pointers from owning memory with pointers in them?

2. require that aggregates with unions in them provide a 
union_pointers range like constructor that will yield all the 
pointers and their types? Standard library constructs with unions 
that contain pointers could provide it, so it would not affect 
the standard library I think.

Or are there other obstacles for precise tracing?

I believe that 2) could be checked at compile time when the code 
attempts to allocate from the GC. Although I guess you would also 
have to forbid allocating raw memory from the GC that is later 
emplaced with types that contain pointers.




More information about the Digitalmars-d mailing list