[Haskell-cafe] Diagnosing stack overflow

Bryan O'Sullivan bos at serpentine.com
Thu Aug 16 23:02:59 EDT 2007

Justin Bailey wrote:
> I am trying to determine why my stack overflows in my medium sized
> program (it has several modules but maybe only 1000 LOC total). On
> Windows, at least, the ghcprof visualization tool doesn't work. Any
> suggestions besides an output trace?

You shouldn't need ghcprof.  Just compiling with -prof -auto-all will be 
enough to get you able to use allocation profiling, then running with 
+RTS -p -RTS will generate an allocation profile as a fairly readable 
text file.

> It may be the function below, which tries to determine if a list of
> strict bytestrings is longer than the count given.

Taking stabs in the dark is not a good idea, and sprinkling strictness 
annotations around in an undirected manner won't help, either, however 
much it might feel like doing something concrete.  Start with looking at 
the profile output.  You'll probably find it's a different part of your 
code entirely that's causing the problem.


More information about the Haskell-Cafe mailing list