scopeDisableGC

Use this macro at the begining of the function body to disable GC during the function execution. It will be automatically enabled at the end of the function scope. Do not use this macro if GC is globally disabled.

immutable
auto scopeDisableGC = "import core.memory : GC; GC.disable; scope (exit) GC.enable;";

Examples

void noGCFunction() {
	mixin(scopeDisableGC); // GC is disabled
	// Your code here...
	// GC is enabled
}

Meta