caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Size limit on marshalling?
@ 2003-01-15 21:25 Yaron M. Minsky
  2003-01-16 13:15 ` Damien Doligez
  0 siblings, 1 reply; 2+ messages in thread
From: Yaron M. Minsky @ 2003-01-15 21:25 UTC (permalink / raw)
  To: Caml List 

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Size limit on marshalling?
  2003-01-15 21:25 [Caml-list] Size limit on marshalling? Yaron M. Minsky
@ 2003-01-16 13:15 ` Damien Doligez
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Doligez @ 2003-01-16 13:15 UTC (permalink / raw)
  To: Yaron M. Minsky; +Cc: Caml List 

On Wednesday, January 15, 2003, at 10:25 PM, Yaron M. Minsky wrote:

> First, I create a pointlessly large array, and then save it to disk:
[...]
> The resulting file is 38400025 bytes long.  Note that the length 
> appears
> to be critical.
[...]
> # let ar = (get_value "foo.val" : string array);;
> # let ar = ();;
> # Gc.compact ();;

This is a known bug (PR#1495) with compaction and demarshalling
of very large values.  It is already fixed in the development version.

Please contact me if you need a patch.

-- Damien

-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-16 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-15 21:25 [Caml-list] Size limit on marshalling? Yaron M. Minsky
2003-01-16 13:15 ` Damien Doligez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).