summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-08 09:24:20 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-12 19:17:15 -0400
commitaf5ed1563a27ff1a4fabd8e20d1dcfbb5651bf5e (patch)
tree936d909d0f4addd76a5979c0ad5935ad7e70e38f /compiler
parent9859eede20bf5a8a11c1fe34a6fd8d125f9c35f6 (diff)
downloadhaskell-af5ed1563a27ff1a4fabd8e20d1dcfbb5651bf5e.tar.gz
Make the OccName field of NotOrphan strict
In GHCi, by default the ModIface is not written to disk, this can leave a thunk which retains a TyCon which ends up retaining a great deal more on the heap. For example, here is the retainer trace from ghc-debug. ``` ... many other closures ... <TyCon:GHC.Core.TyCon:compiler/GHC/Core/TyCon.hs:1755:34-97> Just 0x423162aaa8 <Maybe:GHC.Core.TyCon:compiler/GHC/Core/TyCon.hs:(1936,11)-(1949,13)> FamilyTyCon 0x4231628318 0x4210e06260 0x4231628328 0x4231628340 0x421730a398 0x4231628358 0x4231628380 0x4231628390 0x7f0f5a171d18 0x7f0f7b1d7850 0x42316283a8 0x7f0f7b1d7830 <TyCon:GHC.Core.TyCon:compiler/GHC/Cor e/TyCon.hs:1948:30-32> _thunk( ) 0x4231624000 <OccName:GHC.Iface.Make:compiler/GHC/Iface/Make.hs:724:22-43> NotOrphan 0x42357d8ed8 <IsOrphan:GHC.Iface.Make:compiler/GHC/Iface/Make.hs:724:12-43> IfaceFamInst 0x4210e06260 0x42359aed10 0x4210e0c6b8 0x42359aed28 <IfaceFamInst:GHC.Iface.Make:> ``` Making the field strict squashes this retainer leak when using GHCi.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Core.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs
index ecd9a6ee00..fb93fc093f 100644
--- a/compiler/GHC/Core.hs
+++ b/compiler/GHC/Core.hs
@@ -942,7 +942,7 @@ type MOutCoercion = MCoercion
-- See Note [Orphans]
data IsOrphan
= IsOrphan
- | NotOrphan OccName -- The OccName 'n' witnesses the instance's non-orphanhood
+ | NotOrphan !OccName -- The OccName 'n' witnesses the instance's non-orphanhood
-- In that case, the instance is fingerprinted as part
-- of the definition of 'n's definition
deriving Data