extendMG leaks memory
extendMG :: ModuleGraph -> [NodeKey] -> ModSummary -> ModuleGraph
extendMG ModuleGraph{..} deps ms = ModuleGraph
{ mg_mss = ModuleNode deps ms : mg_mss
, mg_trans_deps = mkTransDeps (ModuleNode deps ms : mg_mss)
, mg_non_boot = case isBootSummary ms of
IsBoot -> mg_non_boot
NotBoot -> extendModuleEnv mg_non_boot (ms_mod ms) ms
}
The mg_non_boot
field is lazy and retains a reference to the previous non-boot ModuleEnv
.
Solution: make it a strict field.
Fixed by !8579 (closed)