Does D's GC release memory back to the OS?

Cauterite via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 26 07:43:52 PDT 2015


On Sunday, 25 October 2015 at 08:56:52 UTC, Jonathan M Davis 
wrote:
> It is my understanding that the GC does not normally ever 
> return memory to the OS

It seems that it does now. In smallAlloc() and bigAlloc(), if 
allocation fails it collects garbage and then:
     if (lowMem) minimize();
On Windows, lowMem is calculated with GlobalMemoryStatus(), and 
is true if "Less than 5 % of virtual address space available"

This is hardly ideal, but better than nothing I guess.


More information about the Digitalmars-d-learn mailing list