logo       

peekCString stack overflow: msg#00005

lang.haskell.glasgow.bugs

Subject: peekCString stack overflow

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.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise