Forked GC explained
frame
frame86 at live.com
Sat Sep 3 13:35:39 UTC 2022
I'm not sure I fully understand how it works. I know that the OS
creates read only memory pages for both and if a memory section
is about to be written, the OS will issue a copy of the pages so
any write operation will be done in it's own copy and cannot mess
up things.
But then is the question, how can memory be marked as free? The
forked process cannot since it writes into a copy - how it is
synchronized then?
Is the GC address root somehow shared between the processes? Or
does the forked process communicate the memory addresses back to
the parent?
If so, does the GC just rely on this?
Are freeing GC operations just locked while the forked process is
running?
What happens if a manually `GC.free()` is called while the forked
process marks the memory as free too but the GC immediately uses
the memory again and then gets the notification to free it from
the forked child? Can this happen?
More information about the Digitalmars-d-learn
mailing list