I\'m used to debug my code using ghci. Often, something like this happens (not so obvious, of course):
ghci> let f@(_:x) = 0:1:zipWith(+)f x ghci> leng
Running it under a shell with ulimit -m set is a fairly easy way. If you want to run with some limit on a regular basis, you can create a wrapper script that does ulimit before running ghci.
ulimit -m
ulimit
ghci