GHCi holds old module information unnecessarily during upsweep on recompilation
When reloading, the GHCi memory should kept constant desirably if newly recompiled modules replaces existing old modules, but the old one is retained so that the GHCi uses twice memory than what it actually needs. The old module is finally deallocated in the next reload so ghci memory is not growing more than 2x as one reloads modules multiple times.
- GHC version used: GHC 9.6.2
- Operating System: macOS Sonoma 14.0
- System Architecture: Apple M1 Max
Fortunately, the source of this problem is identified (
ModIfaceCache is updated with new modules but old modules are still in memory in
old_hpt in the closure of upsweep).