|The Glasgow Haskell Compiler User's Guide, Version 4.06|
|Prev||Chapter 5. Advice on: sooner, faster, smaller, stingier||Next|
“I think I have a space leak…” Re-run your program with +RTS -Sstderr, and remove all doubt! (You'll see the heap usage get bigger and bigger…) [Hmmm…this might be even easier with the -F2s RTS option; so… ./a.out +RTS -Sstderr -F2s...]
Once again, the profiling facilities (Chapter 4) are the basic tool for demystifying the space behaviour of your program.
Strict functions are good for space usage, as they are for time, as discussed in the previous section. Strict functions get right down to business, rather than filling up the heap with closures (the system's notes to itself about how to evaluate something, should it eventually be required).