[GHC] #7300: Allow CAFs kept reachable by FFI to be forcibly made unreachable for GC
GHC
cvs-ghc at haskell.org
Fri Oct 5 13:14:55 CEST 2012
#7300: Allow CAFs kept reachable by FFI to be forcibly made unreachable for GC
-------------------------------------+--------------------------------------
Reporter: absence | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler (FFI)
Version: 7.4.1 | Keywords: unsafe caf gc
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Runtime performance bug | Testcase:
Blockedby: | Blocking:
Related: |
-------------------------------------+--------------------------------------
CAFs used by a foreign exported function are kept reachable the entire
session because GHC can't know when the function will be called from C. If
such a CAF is an evolving expression, like an FRP network, a space leak
occurs because (I'm guessing) the thunks that build up during iteration go
all the way back to the initial CAF, and the GC can't start collecting
because it considers the CAF reachable. According to JaffaCake on the
#haskell IRC channel, the runtime is capable of sovling this problem, it
just needs a function that tells it to consider the specific CAF
unreachable. It is then the responsibility of the user to not call the
foreign exported function after the CAF is forced unreachable.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7300>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list