Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Size limit on marshalling?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yaron M. Minsky <yminsky@C...>
Subject: [Caml-list] Size limit on marshalling?
I've been getting some fairly inexplicable crashes on marshalling and
unmarshalling values, and I'm wondering if anyone has an idea why.  Here's
a code snippet that will crash my copy of ocaml.

First, I create a pointlessly large array, and then save it to disk:

# let save_value fname value =
     let file = open_out_bin fname in
     output_value file value;
     close_out file;;
      val save_value : string -> 'a -> unit = <fun>

# let ar = Array.init (10000 * 256) (fun i -> String.copy "fooobar doobar");;
# save_value "/home/yminsky/foo.val" ar;;

The resulting file is 38400025 bytes long.  Note that the length appears
to be critical.  If you replace "fooobar doobar' with "foobar doobar", the
problem goes away.

At this point, I start a new session of ocaml and reload the value, and
then ensure that it is garbage collected.  That's when I get the segfault.

# let ar = (get_value "foo.val" : string array);;
# let ar = ();;
# Gc.compact ();;

And that's when I get the segfault.  So, any thoughts?  Is this a bug?  Or
just some unspoken limit of the compiler?  This is a dummy example, but
this is a real limit I'm running up against in my code.

Yaron

-- 
|--------/            Yaron M. Minsky              \--------|
|--------\ http://www.cs.cornell.edu/home/yminsky/ /--------|

Open PGP --- KeyID B1FFD916 (new key as of Dec 4th)
Fingerprint: 5BF6 83E1 0CE3 1043 95D8 F8D5 9F12 B3A9 B1FF D916



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners