allocateGlobalBinder leaks UniqueSupplys
@mpickering noticed (using ghc-debug
) that GHC.Iface.Env.allocateGlobalBinder
currently leaks UniqueSupply
s. The reason is that the the Name
is not forced by extendNameCache
, resulting in a Name
thunk which captures a (Unique, UniqueSupply)
thunk.
Likewise, he also found that we allocate chains of NameCache
s as the record update constructing new_name_supply
is not forced.
I think the solution is two-fold:
- make
extendNameCache
strict in itsName
argument as there is little sense deferring this work - make
allocateGlobalBinder
strict innew_name_supply
to ensure that we don't unnecessarily allocate a thunk