<?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/f49ac3009c87068601aa48876ced916e"
  from="Basile STARYNKEVITCH &lt;basile@s...&gt;"
  author="Basile STARYNKEVITCH"
  date="2003-01-08T10:08:53"
  subject="[Caml-list] Buffer.add error"
  prev="2003/01/035716795ff595f64ed101223a2b260d"
  next="2003/01/13f7a2d121988f53dd4fbe7a9590e5e6"
  prev-in-thread="2003/01/035716795ff595f64ed101223a2b260d"
  next-in-thread="2003/01/fb29e8f1afbaa8deaeabffe306b2d071"
  prev-thread="2003/01/09b5be7521e7f17f067191e491e4a57a"
  next-thread="2003/01/13f7a2d121988f53dd4fbe7a9590e5e6"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Buffer.add error">
<msg 
  url="2003/01/035716795ff595f64ed101223a2b260d"
  from="Mikkel Christiansen &lt;mixxel@c...&gt;"
  author="Mikkel Christiansen"
  date="2003-01-08T09:53:07"
  subject="[Caml-list] Buffer.add error">
<msg 
  url="2003/01/f49ac3009c87068601aa48876ced916e"
  from="Basile STARYNKEVITCH &lt;basile@s...&gt;"
  author="Basile STARYNKEVITCH"
  date="2003-01-08T10:08:53"
  subject="[Caml-list] Buffer.add error">
<msg 
  url="2003/01/fb29e8f1afbaa8deaeabffe306b2d071"
  from="Eric C. Cooper &lt;ecc@c...&gt;"
  author="Eric C. Cooper"
  date="2003-01-08T17:03:05"
  subject="Re: [Caml-list] Buffer.add error">
<msg 
  url="2003/01/0c306debbf9d2c9dfcb5287b6a29bcb2"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-09T20:34:13"
  subject="Re: [Caml-list] Buffer.add error">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
&gt;&gt;&gt;&gt;&gt; "Mikkel" == Mikkel Christiansen &lt;mixxel@cs.auc.dk&gt; writes:

    Mikkel&gt; Hi I'm having trouble with the buffer library in ocaml
    Mikkel&gt; (version 3.06 - debian). Program was compiled to native
    Mikkel&gt; using ocamlopt.

    Mikkel&gt; When generating a rather large string I get the following
    Mikkel&gt; error:

    Mikkel&gt;     Fatal error: exception Failure("Buffer.add: cannot
    Mikkel&gt; grow buffer")

    Mikkel&gt; Is there any way to avoid this (except writing directly to
    Mikkel&gt; a file)?


I suggest looking into the sources. In ocaml/stdlib/buffer.ml you can
read (near line 43)

    if b.position + more &lt;= Sys.max_string_length
    then new_len := Sys.max_string_length
    else failwith "Buffer.add: cannot grow buffer"

So basically, you are hitting the limits of maximal string size (which
is 2^24 = 16777216 on 32 bits plateform).

Hence you cannot avoid it, except by switching to a 64 bits plateform.

You might change your algorithms - perhaps by keeping in memory a
vector of buffers or lines or paragraphs (whatever these are in your
application).




-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile&lt;at&gt;starynkevitch&lt;dot&gt;net 
alias: basile&lt;at&gt;tunes&lt;dot&gt;org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
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>

