<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/7d4610f16e08aad0001774d1862258d2"
  from="Yaron M. Minsky &lt;yminsky@C...&gt;"
  author="Yaron M. Minsky"
  date="2003-01-15T21:25:55"
  subject="[Caml-list] Size limit on marshalling?"
  prev="2003/01/cb8a88ca7e675f77b1cc337427964d72"
  next="2003/01/5ca757063c7fae3284cbb1919186faa3"
  next-in-thread="2003/01/152dfa1129cffd7fe8ca2b4193564c10"
  prev-thread="2003/01/b5d0186ce6e333fe2b6c01d25588830a"
  next-thread="2003/01/e79a9acfb922cdb850c2b11651201b4f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Size limit on marshalling?">
<msg 
  url="2003/01/7d4610f16e08aad0001774d1862258d2"
  from="Yaron M. Minsky &lt;yminsky@C...&gt;"
  author="Yaron M. Minsky"
  date="2003-01-15T21:25:55"
  subject="[Caml-list] Size limit on marshalling?">
<msg 
  url="2003/01/152dfa1129cffd7fe8ca2b4193564c10"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-01-16T13:13:35"
  subject="Re: [Caml-list] Size limit on marshalling?">
</msg>
</msg>
</thread>

<contents>
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 -&gt; 'a -&gt; unit = &lt;fun&gt;

# let ar = Array.init (10000 * 256) (fun i -&gt; 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

</contents>

</message>

