Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions changelog/druntime.tgc.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Opt-in thread-local GC (`tgc`)

A new garbage collector implementation can be selected with
`--DRT-gcopt=gc:tgc`.

Each attached thread owns a private heap arena. Collection scans and sweeps only
that thread's stack, TLS, and blocks — it does not issue a process-wide
stop-the-world pause. Threads detached via `thread_detachThis()` are never
paused by `tgc` collections.

Cross-thread sharing of GC pointers is unsupported in this first version except
through ownership transfer that returns memory via a remote free list. Prefer
copy or `immutable` message passing (`std.concurrency`). Partitioned shared
regions are planned as a later phase.

Informally this collector is sometimes called a "realtime GC" because it avoids
global pauses; the registered name is `tgc` (thread garbage collection).
3 changes: 3 additions & 0 deletions druntime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ $(DOC_OUTPUT_DIR)/core_internal_gc_impl_conservative_%.html : import/core/intern
$(DOC_OUTPUT_DIR)/core_internal_gc_impl_manual_%.html : import/core/internal/gc/impl/manual/%.d $(DMD)
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<

$(DOC_OUTPUT_DIR)/core_internal_gc_impl_tgc_%.html : import/core/internal/gc/impl/tgc/%.d $(DMD)
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<

$(DOC_OUTPUT_DIR)/core_internal_gc_impl_proto_%.html : import/core/internal/gc/impl/proto/%.d $(DMD)
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<

Expand Down
1 change: 1 addition & 0 deletions druntime/mak/COPY
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ COPY=\
$(IMPDIR)\core\internal\gc\proxy.d \
$(IMPDIR)\core\internal\gc\impl\conservative\gc.d \
$(IMPDIR)\core\internal\gc\impl\manual\gc.d \
$(IMPDIR)\core\internal\gc\impl\tgc\gc.d \
$(IMPDIR)\core\internal\gc\impl\proto\gc.d \
\
$(IMPDIR)\core\internal\container\array.d \
Expand Down
1 change: 1 addition & 0 deletions druntime/mak/DOCS
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ DOCS=\
$(DOCDIR)\core_internal_gc_proxy.html \
$(DOCDIR)\core_internal_gc_impl_conservative_gc.html \
$(DOCDIR)\core_internal_gc_impl_manual_gc.html \
$(DOCDIR)\core_internal_gc_impl_tgc_gc.html \
$(DOCDIR)\core_internal_gc_impl_proto_gc.html \
\
$(DOCDIR)\rt_aApply.html \
Expand Down
1 change: 1 addition & 0 deletions druntime/mak/SRCS
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ SRCS=\
src\core\internal\gc\proxy.d \
src\core\internal\gc\impl\conservative\gc.d \
src\core\internal\gc\impl\manual\gc.d \
src\core\internal\gc\impl\tgc\gc.d \
src\core\internal\gc\impl\proto\gc.d \
\
src\core\internal\util\array.d \
Expand Down
Loading
Loading