On 27/6/20 13:21, Stanislav Blinov wrote:
I would think collect + minimize should do the trick. Just keep in mind that that's grossly inefficient.
If you are using linux, have in mind that the memory is often not returned to the OS even after a (libc) free. If you check with tools like `top`, it'll still show as assigned to the process.
What I had to do (both in D and in C/C++) was to call malloc_trim [1] manually to have the memory actually sent back to the OS.
[1]: https://man7.org/linux/man-pages/man3/malloc_trim.3.html
