简体   繁体   中英

Stack space overflow error in Haskell with a very small stack size

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?

It's a bug in GHC; the reported stack size in the message is wrong. See https://ghc.haskell.org/trac/ghc/ticket/10445 and thanks for noticing that it's not actually fixed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM