|The Glasgow Haskell Compiler User's Guide, Version 5.04|
|Prev||Chapter 6. Advice on: sooner, faster, smaller, thriftier||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 -G1 RTS option; so… ./a.out +RTS -Sstderr -G1...]
Once again, the profiling facilities (Chapter 5) 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).