[Haskell-cafe] Alternative to Data.Binary

Svein Ove Aas svein.ove at aas.no
Sat Mar 14 09:16:33 EDT 2009

On Sat, Mar 14, 2009 at 1:37 PM, Grzegorz Chrupala
<grzegorz.chrupala at computing.dcu.ie> wrote:
> Hi all,
> Is there a serialization library other than the Data.Binary from hackage?
> I am using Data.Binary in a couple of projects, but I have found its stack
> and memory usage very hard to control. Its very common that decoding a map
> or list of non-trivial size uses up all available RAM, or causes a stack
> overflow.
That little problem appears to be an artifact of the particular Binary
instance for lists (the map instance starts by converting to/from a
list), and should be fixable in principle, for example by writing them
in chunks of 256 elements.

That said, the current instance really should only have problems when
*writing*, in that it'll force the entire list to figure out its
length before it starts writing any of it. That this is not, in fact,
the case suggests that the reader should be fixable without changing
its on-disk format.

Svein Ove Aas

More information about the Haskell-Cafe mailing list