forked from GitHub/gf-core
pgf-shell: enable -rtsopts, call performGC between commands
This is to make it easier to find the cause of space leaks.
This commit is contained in:
2
gf.cabal
2
gf.cabal
@@ -255,6 +255,8 @@ executable pgf-shell
|
|||||||
hs-source-dirs: src/runtime/haskell-bind/examples
|
hs-source-dirs: src/runtime/haskell-bind/examples
|
||||||
build-depends: gf, base
|
build-depends: gf, base
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
if impl(ghc>=7.0)
|
||||||
|
ghc-options: -rtsopts
|
||||||
|
|
||||||
test-suite rgl-tests
|
test-suite rgl-tests
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import System.IO.Error(catchIOError)
|
|||||||
import System.Environment
|
import System.Environment
|
||||||
import CRuntimeFFI
|
import CRuntimeFFI
|
||||||
import CId
|
import CId
|
||||||
|
import System.Mem(performGC)
|
||||||
|
|
||||||
main = getPGF =<< getArgs
|
main = getPGF =<< getArgs
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ getPGF [path] = pgfShell =<< readPGF path
|
|||||||
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
|
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
|
||||||
|
|
||||||
pgfShell pgf =
|
pgfShell pgf =
|
||||||
forever $ do putStr "> "; hFlush stdout
|
forever $ do performGC
|
||||||
|
putStr "> "; hFlush stdout
|
||||||
execute pgf =<< readLn
|
execute pgf =<< readLn
|
||||||
|
|
||||||
execute pgf cmd =
|
execute pgf cmd =
|
||||||
|
|||||||
@@ -31,3 +31,5 @@ executable pgf-shell
|
|||||||
hs-source-dirs: examples
|
hs-source-dirs: examples
|
||||||
build-depends: base, haskell-bind
|
build-depends: base, haskell-bind
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
if impl(ghc>=7.0)
|
||||||
|
ghc-options: -rtsopts
|
||||||
|
|||||||
Reference in New Issue
Block a user