Fix potential space leak that arises from excessive laziness in ModuleGraph
Fix potential space leak that arises from ModuleGraphs retaining references
to previous ModuleGraphs. This manifests in particular in extendMG.
Fixes #21816 (closed)
Edited by Zubin