Space usage

Ian Lynagh igloo at
Sat Jun 12 13:54:06 EDT 2004

Hi all,

My intuition tells me that the code in

should have the same space usage regardless of whether USESMEM is
defined. However, when compiling with

    ghc -Wall -O2 -cpp           --make Mem -o mem

and running

    ./mem True 100000 > /dev/null

it runs in constant space but compiling with

    ghc -Wall -O2 -cpp -DUSESMEM --make Mem -o mem

and running in the same way it increases up to >100M.

Is this an instance of GHC not being as smart as it could?

Or is it a case in which I need to give it additional strictness
annotations in order to get it to run in constant space (and if so,
what annotations would be best?)?


More information about the Glasgow-haskell-users mailing list