Thread overview |
---|
October 18, 2019 Is there has document that about dlang GC design and implement? | ||||
---|---|---|---|---|
| ||||
exclude read source, how to learn GC implement。 |
May 24, 2020 Re: Is there has document that about dlang GC design and implement? | ||||
---|---|---|---|---|
| ||||
Posted in reply to lili | On Friday, 18 October 2019 at 07:07:06 UTC, lili wrote: > exclude read source, how to learn GC implement。 Google search “gc document site:dlang.org” may find some info, e.g. https://wiki.dlang.org/DIP46 |
May 24, 2020 Re: Is there has document that about dlang GC design and implement? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mw | On Sunday, 24 May 2020 at 16:12:44 UTC, mw wrote: > On Friday, 18 October 2019 at 07:07:06 UTC, lili wrote: >> exclude read source, how to learn GC implement。 > > Google search “gc document site:dlang.org” > > may find some info, e.g. > > https://wiki.dlang.org/DIP46 https://dlang.org/spec/garbage.html esp. https://dlang.org/spec/garbage.html#how_gc_works How Garbage Collection Works The GC works by: Stopping all other threads than the thread currently trying to allocate GC memory. ‘Hijacking’ the current thread for GC work. Scanning all ‘root’ memory ranges for pointers into GC allocated memory. Recursively scanning all allocated memory pointed to by roots looking for more pointers into GC allocated memory. Freeing all GC allocated memory that has no active pointers to it and do not need destructors to run. Queueing all unreachable memory that needs destructors to run. Resuming all other threads. Running destructors for all queued memory. Freeing any remaining unreachable memory. Returning the current thread to whatever work it was doing. |
Copyright © 1999-2021 by the D Language Foundation