
15 Aug
2003
15 Aug
'03
11:17 a.m.
I'm currently in a situation where my program runs easily out of stack. Depending on the input, stack usage often exceeds 10Mb.
I have better than 75% success locating the source of these bugs with the following command: grep '+1' *.hs *.lhs Reason: Lazy arithmetic can easily cause you to build thunks that look like this: 1+1+1+1+ .... + 1 + 0 which take O(n) heap to store and O(n) stack to evaluate (with constant factors of around 10-20). If you've already tried this approach, the tolols SimonM mentions are well worth using. -- Alastair Reid