[GHC] #13110: GHC API allocates memory which is never GC'd

GHC ghc-devs at haskell.org
Mon Apr 17 10:12:55 UTC 2017


#13110: GHC API allocates memory which is never GC'd
-------------------------------------+-------------------------------------
        Reporter:  DanielG           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHC API           |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonmar):

 @rwbarton's comment above is correct.

 GHC keeps a hash table of strings (the `FastString` table) that is never
 deallocated.  This is likely the 20MB you're seeing.  If this is really a
 problem for you, then we could provide a way via the GHC API to clear the
 table. (but I'm surprised if this is really a problem, GHC will keep a lot
 of other data structures while it is being used, such as all the interface
 files it read)

 `resetCAFs` only applies to code that is dynamically loaded by the RTS
 linker, so it's not doing anything in your case - the ghc package is
 statically linked into your binary.

 You do need to force a major GC as @rwbarton mentioned to get the RTS to
 return memory to the OS.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13110#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list