3 ms·
You don't have to have GC in D, and manual memory can work side-by-side the GC with or without disabling it. You can delete objects early, or call GC.disable
by shakna 10y ago
You don't have to have GC in D, and manual memory can work side-by-side the GC with or without disabling it.
You can delete objects early, or call GC.disable
- bachmeier 10y agoThe 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.
- destructionator 10y ago> 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.
- bachmeier 10y agoI'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.