www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.internals - Is there has document that about dlang GC design and

reply lili <akozhao tencent.com> writes:
exclude read source, how to learn GC implement。
Oct 18 2019
parent reply mw <mingwu gmail.com> writes:
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
parent mw <mingwu gmail.com> writes:
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.
May 24 2020