summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/TyCl/Instance.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-07-21 09:32:37 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-23 21:09:17 -0400
commitb26a7065cec7ade894b8318aae66610e345b7e78 (patch)
tree2f6e67937a457a7a0c39a837a81a2c4e43d2e476 /compiler/GHC/Tc/TyCl/Instance.hs
parent6c79981e646a9983e959ccbf67f6c11b86bdbc6f (diff)
downloadhaskell-b26a7065cec7ade894b8318aae66610e345b7e78.tar.gz
Fix a few retainer leaks of TcGblEnv
Methodology: Create a -hi profile and then search for TcGblEnv then use ghc-debug to work out why they are being retained and remove the reason. Retaining TcGblEnv is dangerous because it contains pointers to things such as a TypeEnv which is updated throughout compilation. I found two places which were retaining a TcGblEnv unecessarily. Also fix a few places where an OccName was retaining an Id.
Diffstat (limited to 'compiler/GHC/Tc/TyCl/Instance.hs')
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/TyCl/Instance.hs b/compiler/GHC/Tc/TyCl/Instance.hs
index 760c8c6438..5f56c3c830 100644
--- a/compiler/GHC/Tc/TyCl/Instance.hs
+++ b/compiler/GHC/Tc/TyCl/Instance.hs
@@ -1981,7 +1981,8 @@ mkMethIds clas tyvars dfun_ev_vars inst_tys sel_id
; return (poly_meth_id, local_meth_id) }
where
sel_name = idName sel_id
- sel_occ = nameOccName sel_name
+ -- Force so that a thunk doesn't end up in a Name (#19619)
+ !sel_occ = nameOccName sel_name
local_meth_ty = instantiateMethod clas sel_id inst_tys
poly_meth_ty = mkSpecSigmaTy tyvars theta local_meth_ty
theta = map idType dfun_ev_vars