summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-08 09:24:20 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-10-11 22:50:42 +0100
commit6d23d0fcfe8ff8111b142f090ab88c7c2fa0a8a0 (patch)
treee400475f5b7932beb39e3865b626b8eba6a9c8e8
parent245ab1662edd91a82c17de110c79450fec3f7b82 (diff)
downloadhaskell-6d23d0fcfe8ff8111b142f090ab88c7c2fa0a8a0.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.
-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