Garbage collection
Stanislav Blinov
stanislav.blinov at gmail.com
Sat Jun 27 11:21:13 UTC 2020
On Saturday, 27 June 2020 at 11:11:38 UTC, James Gray wrote:
> I am measuring the memory usage using top from the command line.
> GC.minimize() does seem to stop the leak.
That is not a memory leak. That's the allocator keeping pages for
itself to not have to go to the kernel every time you allocate.
> But it doesn't explain why the program isn't releasing
> essentially all the memory between calls to f (it using around
> 2GB ram all the time).
Allocators usually don't do that. They keep (at least some)
memory mapped to make allocations more efficient.
> Is there a way of achieving that?
I would think collect + minimize should do the trick. Just keep
in mind that that's grossly inefficient.
More information about the Digitalmars-d-learn
mailing list