On Sunday, October 25, 2015 05:49:42 Richard White via Digitalmars-d-learn wrote: > Just wondering if D's GC release memory back to the OS? > The documentation for the GC.minimize > (http://dlang.org/phobos/core_memory.html#.GC.minimize) seems to > imply that it does, > but watching my OS's memory usage for various D apps doesn't > support this.
It is my understanding that the GC does not normally ever return memory to the OS (though it's been worked on quite a bit over the last couple of years, so that may have changed - probably not though, since that wouldn't really help memory performance and could actually hurt it). minimize's documentation clearly indicates that it returns memory to the OS, but that doesn't necessarily mean that the GC ever does that on its own. It just means that the GC provides a way for the programmer to tell it to return memory to the OS. And I would guess that calling minimize frequently would harm performance. It probably mostly makes sense after you know that your program has used a lot of memory for something and isn't going to need that memory again. But the functions in core.memory are intended for performance tweaking for the adventurous and/or those who really need to tweak performance as opposed to something that a typical program would do. - Jonathan M Davis
