Stack overflow with Data.Binary

Christian Maeder maeder at tzi.de
Mon Jun 4 12:04:57 EDT 2007


I've tried your code with ghc-6.6.1 under x86 linux with binary-0.3:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3

It does terminate for me with and without profiling and/or optimization,
when I pass in the source file itself as input:

  $ ./foo  < foo.hs

Is this a confirmation of your observation or am I (are we) doing
something wrong?

Cheers Christian

Grzegorz schrieb:
> Hi,
> I just spent some time trying to find a stack overflow bug. I seem to have
> narrowed it down to somewhere probably related to the default Binary instances.
> 
> It only seems to overflow when compiling with -prof. The following is a
> reasonably minimal example.
> 
> Any ideas of what might be going on?
> 
> -- foo.hs 
> -- compiled with:
> -- ghc  -O2  -prof --make foo.hs
> 
> -- $ ./foo  < okok
> -- Stack space overflow: current size 8388608 bytes.
> -- Use `+RTS -Ksize' to increase it.
> 
> import Data.IntMap
> import qualified Data.ByteString.Lazy as BS
> import Data.Binary 
> 
> main = do
>   s <- BS.getContents
>   print . size  . snd $ (decode $ s::(IntMap Double,IntMap (Int,Maybe String)))
> 
> --
> Grzegorz


More information about the Libraries mailing list