ghci leaks memory
The following script spawns ghci, and that spawned ghci then goes on to leak memory:
import Control.Concurrent
import Control.Monad
import System.IO
import System.Process
main = do
(Just hin, Nothing, Nothing, pid) <- createProcess (proc "ghci" ["+RTS","-S"]){std_in=CreatePipe}
forever $ do
threadDelay 100000 -- 0.1s
hPutStrLn hin "\"this is a test of outputting stuff\""
hFlush hin
This script just writes a string to GHCi, which then echos it back. The +RTS -S
is useful to watch the live memory tick up in realtime, but it leaks without it, and the leak can be seen in process explorer (87Mb to 700Mb over about 30 minutes).
While repeatedly writing commands may not be a standard usage of ghci, it is when driven by tools such as ghcid (https://hackage.haskell.org/package/ghcid) and other IDE-like uses.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |