peekCString stack overflow

George Russell ger at tzi.de
Wed Oct 1 11:25:49 EDT 2003


The following program gives me a stack overflow for a file "big.tex"
150000 bytes long.

-- Cut here --
module Main where

import Foreign.C.String
import Foreign.Ptr
import qualified GHC.IO

main =
    do
       (ptr,len) <- GHC.IO.slurpFile "big.tex"
       peekCStringLen (castPtr ptr,len)
       return ()
-- Cut here --

The message is "Stack space overflow: current size 1048576 bytes."

Could peekCStringLen be changed so it does not expect stack space
proportionate to the input string?  I use this method quite a lot
for slurping strings in and out, so as it is the situation is
inconvenient.






More information about the Glasgow-haskell-bugs mailing list