From 5fe6aaa3756cda654374ebfd883fa8f064ff64a4 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 2 May 2018 11:01:13 +0100 Subject: Add -fghci-leak-check to check for space leaks Summary: Space leaks in GHCi emerge from time to time and tend to come back again after they get fixed. This is an attempt to limit regressions by * adding a reliable detection for some classes of space leaks in GHCi * turning on leak checking for all GHCi tests in the test suite, so that we'll notice if the leak appears again. The idea for detecting space leaks is quite simple: * find some data that we expect to be GC'd later, make a weak pointer to it * when we expect the data to be dead, do a `performGC` and then check the status of the weak pointer. It would be nice to apply this trick to lots of things in GHC, e.g. ensuring that HsSyn is not retained after the desugarer, or ensuring that CoreSyn from the previous simplifier pass is not retained. Test Plan: validate Reviewers: bgamari, simonpj, erikd, niteria Subscribers: thomie, carter GHC Trac Issues: #15111 Differential Revision: https://phabricator.haskell.org/D4658 --- compiler/main/DynFlags.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler') diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 6bfa8f2955..734c0a1fa9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -533,6 +533,7 @@ data GeneralFlag | Opt_IgnoreDotGhci | Opt_GhciSandbox | Opt_GhciHistory + | Opt_GhciLeakCheck | Opt_LocalGhciHistory | Opt_NoIt | Opt_HelpfulErrors @@ -3934,6 +3935,7 @@ fFlagsDeps = [ flagSpec "fun-to-thunk" Opt_FunToThunk, flagSpec "gen-manifest" Opt_GenManifest, flagSpec "ghci-history" Opt_GhciHistory, + flagSpec "ghci-leak-check" Opt_GhciLeakCheck, flagGhciSpec "local-ghci-history" Opt_LocalGhciHistory, flagGhciSpec "no-it" Opt_NoIt, flagSpec "ghci-sandbox" Opt_GhciSandbox, -- cgit v1.2.1