[Haskell-cafe] Diagnose stack space overflow

Ketil Malde ketil at malde.org
Fri Jul 8 11:29:40 CEST 2011


Max Bolingbroke <batterseapower at hotmail.com> writes:

>> Stack space overflow: current size 8388608 bytes.
>> Use `+RTS -Ksize -RTS' to increase it.

>> I want to find out the culprit function and rewrite it tail-recursively. Is
>> there a way to find out which function is causing this error other
>> than reviewing the code manually?

> It's possible that building your program with profiling and then
> running with "+RTS -xc" will print a useful call stack.

Does this help, really?  I've tried that occasionally, but can't really
say it's ever helped pinpoint the problem.  (Not complaining, stack
traces are hard in Haskell.)

I generally heap-profile (often with the -hd option), most stack
overflows will also retain heap data (i.e. a stack of (+) operations
will point to all the numbers as well), which should give you an idea of
where to look.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list