Skip to content

allocateGlobalBinder leaks UniqueSupplys

@mpickering noticed (using ghc-debug) that GHC.Iface.Env.allocateGlobalBinder currently leaks UniqueSupplys. 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 NameCaches as the record update constructing new_name_supply is not forced.

I think the solution is two-fold:

  • make extendNameCache strict in its Name argument as there is little sense deferring this work
  • make allocateGlobalBinder strict in new_name_supply to ensure that we don't unnecessarily allocate a thunk
Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information