debugging - Is there a way to limit the memory, ghci can have? -
i'm used debug code using ghci. often, happens (not obvious, of course):
ghci> let f@(_:x) = 0:1:zipwith(+)f x ghci> length f
then, nothing happens time, , if don't react fast enough, ghci has eaten maybe 2 gb of ram, causing system freeze. if it's late, way solve problem [alt] + [print] + [k].
my question: there easy way limit memory, can consumed ghci to, let's 1 gb? if limit exceed, calculation should ve aborted or ghci should killed.
a platform independant way accomplish supply -m
option on option haskell runtime this
ghci +rts -m1m
see the ghc documentation’s page on how control rts (runtime system) details.
the ghci
output looks like:
>ghci +rts -m10m ghci, version 6.12.3: http://www.haskell.org/ghc/ :? loading package ghc-prim ... linking ... done. loading package integer-gmp ... linking ... done. loading package base ... linking ... done. loading package ffi-1.0 ... linking ... done. prelude> let f@(_:x) = 0:1:zipwith(+)f x prelude> length f heap exhausted; current maximum heap size 10485760 bytes (10 mb); use `+rts -m<size>' increase it.
Comments
Post a Comment