2 days ago

Is it the case that GC.collect forces a typical GC cycle, and GC.minimize does a full mark and sweep?

22 hours ago
On 9/23/25 7:33 AM, Brother Bill wrote:
> Is it the case that GC.collect forces a typical GC cycle, and
> GC.minimize does a full mark and sweep?

GC.collect is already "full collection" as quoted from here:

  https://dlang.org/library/core/memory/gc.collect.html

GC.minimize is a request to GC to give the underlying unused memory back to the OS. To me, it's useful in rare cases where an application does lots of allocations early on and then gets into a steady state of low memory usage. The program can request the GC before getting to that steady state to give the memory back to the OS, which the GC might still be holding on in hopes of reusing it in the future.

So, a GC.minimize translation: "I know I will not need memory close to what I've used so far; give all your free blocks back to the OS."

Ali