The Haskell program
main=main>>main
fails with
2mem: Stack space overflow: current size 33624 bytes.
2mem: Use `+RTS -Ksize -RTS' to increase it.
33k seems quite small. The OS (via top) is reporting a total memory usage of 6G before failing. When I compile the program with ghc -rtsopts 2mem.hs and run it with ./2mem +RTS -K32M I sill get the same error.
I'm using ghc, version 8.0.1 on MacOS 10.11.6.
Why is the stack space so small and why doesn't -K32M increase it?
main = main, but the later will produce a<<loop>>exception instead of a stack overflow. 33K is a pretty large stack for the way GHC uses it.