Feature request: force memory return
Motivation
Suppose you have an application that is split between doing memory intensive computations and low memory computations. We don't want the RTS to retain memory from the memory heavy bits when its no longer necessary. The -Fd
option was introduced to help with this. It allows unnecessary memory to be returned after subsequent idle GCs.
Yet, sometimes it is helpful for the application developer to force this return to happen manually. This is similar to how System.Mem
exports actions to force a GC.
Proposal
Add a new IO action to System.Mem
that forces all unnecessary memory to be returned to the OS. This would return the memory to the same baseline as you'd get if -Fd
was allowed to return as much as possible.
There should be some documentation that explains that this can lead to thrashing if used excessively.