Re: [Haskell-cafe] how to debug stack overflow?

2013-06-22 Thread Johannes Waldmann
Aleksey Uymanov  gmail.com> writes:

> Try to use heap profiling. There is very high probability that the
> problem is because of space leak.

Really? Would it help in the standard example:

main = print $ foldr (+) 0 [1 .. 1::Int]

this leaks space (that is, cannot run in small space)
only because it leaks closures, right?
but how I'm going to recognize them in the heap profile?

When I run the above with +RTS -K1G -M1G -h -p
I do indeed get heap overflow (instead of stack overflow)
but the heap profile shows an allocation of 30k bytes only.

- J.W.



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to debug stack overflow?

2013-06-22 Thread Aleksey Uymanov
On Sat, 22 Jun 2013 11:04:21 + (UTC)
Johannes Waldmann  wrote:

> What is the recommended method 

Try to use heap profiling. There is very high probability that the
problem is because of space leak.

-- 
Aleksey Uymanov 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] how to debug stack overflow?

2013-06-22 Thread Johannes Waldmann
What is the recommended method 
to find the exact reason for a stack overflow
(when running a Haskell program compiled with ghc)?

When I compile with -prof -auto-all, and run with +RTS -xc,
I see a very short call stack, which can't be right. 
But that's probably because I am calling some library method 
that was compiled without -auto-all so it's invisible in the trace?

I can avoid the overflow by +RTS -K1G  or something
but I want to investigate because it might indicate
some inefficiency in the code (evaluations happening
at the wrong time).

- J.W.



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe