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. 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). Is there a way of
achieving that?
It's not a leak. The GC allocates memory as it needs it and holds
on to it. When something is collected, the GC can reuse then
released memory when it needs it.