From d1ab3072dbc8e4929bd3d3b7bebeaac7c64bc53b Mon Sep 17 00:00:00 2001 From: hallgren Date: Fri, 7 Feb 2014 13:57:13 +0000 Subject: [PATCH] pgf-shell: enable -rtsopts, call performGC between commands This is to make it easier to find the cause of space leaks. --- gf.cabal | 2 ++ src/runtime/haskell-bind/examples/pgf-shell.hs | 4 +++- src/runtime/haskell-bind/haskell-bind.cabal | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gf.cabal b/gf.cabal index 5824aaed2..dd74aaf92 100644 --- a/gf.cabal +++ b/gf.cabal @@ -255,6 +255,8 @@ executable pgf-shell hs-source-dirs: src/runtime/haskell-bind/examples build-depends: gf, base default-language: Haskell2010 + if impl(ghc>=7.0) + ghc-options: -rtsopts test-suite rgl-tests type: exitcode-stdio-1.0 diff --git a/src/runtime/haskell-bind/examples/pgf-shell.hs b/src/runtime/haskell-bind/examples/pgf-shell.hs index 04b6522da..224c16512 100644 --- a/src/runtime/haskell-bind/examples/pgf-shell.hs +++ b/src/runtime/haskell-bind/examples/pgf-shell.hs @@ -14,6 +14,7 @@ import System.IO.Error(catchIOError) import System.Environment import CRuntimeFFI import CId +import System.Mem(performGC) main = getPGF =<< getArgs @@ -21,7 +22,8 @@ getPGF [path] = pgfShell =<< readPGF path getPGF _ = putStrLn "Usage: pgf-shell " pgfShell pgf = - forever $ do putStr "> "; hFlush stdout + forever $ do performGC + putStr "> "; hFlush stdout execute pgf =<< readLn execute pgf cmd = diff --git a/src/runtime/haskell-bind/haskell-bind.cabal b/src/runtime/haskell-bind/haskell-bind.cabal index 8f8f62321..31f2a75d2 100644 --- a/src/runtime/haskell-bind/haskell-bind.cabal +++ b/src/runtime/haskell-bind/haskell-bind.cabal @@ -31,3 +31,5 @@ executable pgf-shell hs-source-dirs: examples build-depends: base, haskell-bind default-language: Haskell2010 + if impl(ghc>=7.0) + ghc-options: -rtsopts