In a recent question about stack overflows in Haskell kosmikus said the default stack size of GHCi is 512 MB. I would much rather have a smaller stack size, like 2 MB or something, because if I go beyond that, in almost all cases, it will be because of an error on my part. My system doesn't have very much RAM, so a stack size of 512 MB sometimes causes some crazy swapping and slowness when I make a mistake in the code.
Is there a way to limit the default stack size of GHCi, in the .ghci
file or somewhere else?
I'm aware that I should be able to create an
alias ghci='ghci +RTS -K2M -RTS'
as a last resort, but I'd like to avoid that if possible.
ghci
binary is actually the same as theghc
binary, and limiting its stack size means you're limiting the stack size during compilation as well. Setting it to a really small value can yield errors coming from the compilation. For example, runningghci +RTS -K1K
immediately crashes. – kosmikus Dec 1 '13 at 16:09RtsFlags.GcFlags.maxStkSize
from a running Haskell program to be able to set stack size from.ghci
. Which is the same as the linked question. – Mikhail Glushenkov Dec 1 '13 at 17:57