When playing with various algorithms in Haskell it often happens to me that I create a program with a memory leak, as it often happens with lazy evaluation. The program taking all the memory isn't really fun, I often have difficulty killing it if I realize it too late.
When using GHC6 I simply had export GHCRTS='-M384m'
in my .bashrc
. But in GHC7 they added a security measure that unless a program is compiled with -rtsopts
, it simply fails when it is given any RTS option either on a command line argument or in GHCRTS
. Unfortunately, almost no Haskell programs are compiled with this flag, so setting this variable makes everything to fail (as I discovered in After upgrading to GHC7, all programs suddenly fail saying "Most RTS options are disabled. Link with -rtsopts to enable them.").
Any ideas how to make any use of GHCRTS
with GHC7, or another convenient way how to prevent my programs taking all memory?
You can compile your own programs with -with-rtsopts=-M384m
to set RTS options at compile time (once and for all). You could also set up a "blacklist" of programs that shouldn't be run with GHCRTS
in your .bashrc
; perhaps something like
for i in foo bar baz
do
alias $i="GHCRTS= $i"
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With