1 2 3 4 5 6 7 8 9 10 11 12
import core.memory; void main() { auto collections = GC.profileStats().numCollections; // loop until we trigger a collection for (;;) { cast(void)GC.malloc(100_000, GC.BlkAttr.NO_SCAN); if (GC.profileStats().numCollections == collections+1) break; } }