Forked GC explained

Steven Schveighoffer schveiguy at
Mon Sep 5 18:35:02 UTC 2022

On 9/5/22 7:12 AM, frame wrote:
> And what if the programmer has no actual reference but wrongly forced a 
> `free()` through a pointer cast?

* Do not store pointers into non-pointer variables using casts and other 
void* p;
int x = cast(int)p;   // error: undefined behavior
The garbage collector does not scan non-pointer fields for GC pointers.

Note that this does not require the forked GC to cause this problem.


More information about the Digitalmars-d-learn mailing list