File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -3752,6 +3752,14 @@ $(H2 $(LNAME2 nogc-functions, No-GC Functions))
3752
3752
}
3753
3753
---
3754
3754
3755
+ $(BEST_PRACTICE Since a function marked `@nogc` will not do any GC allocations,
3756
+ that implies it will not cause any GC collections to run. However,
3757
+ another thread may still allocate with the GC and trigger a collection.
3758
+ The recommended way to prevent GC collections from being run is to call
3759
+ $(LINK2 https://dlang.org/phobos/core_memory.html#GC.disable, core.memory.GC.disable())
3760
+ instead. This will stop collections from being run in any thread until a corresponding
3761
+ call to `core.memory.GC.enable()` is run. GC allocations can still be performed
3762
+ when `GC.disable()` is in effect.)
3755
3763
3756
3764
$(H2 $(LNAME2 function-safety, Function Safety))
3757
3765
You can’t perform that action at this time.
0 commit comments