How to protect against GHC7 compiled programs taking all memory?

Posted by Petr Pudlák on Stack Overflow See other posts from Stack Overflow or by Petr Pudlák
Published on 2012-09-07T18:22:09Z Indexed on 2012/09/08 15:38 UTC
Read the original article Hit count: 194

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about haskell

Related posts about memory-leaks