Re:Metaprogramming is less fun in D
by bachmeier on Friday April 21, 2017 @02:15PM
(#14167901)
The safer approach is to mark that code @nogc. There is no guarantee that the GC won't run when calling GC.disable. You do get a guarantee with @nogc.
[ Parent
| on HN ]
Re:Metaprogramming is less fun in D
by destructionator on Friday April 21, 2017 @05:09PM
(#14169443)
> There is no guarantee that the GC won't run when calling GC.disable.
If you have called GC.disable, the collector becomes `return;`. Sure, the GC function is called, but it doesn't do anything, it just immediately returns.
I'm not sure tbh. The documentation says "Collections may continue to occur in instances where the implementation deems necessary for correct program behavior, such as during an out of memory condition." My understanding from the forum discussions is that a collection could happen and you would not know about it.