From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA21964; Wed, 8 Jan 2003 11:08:53 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA21963 for ; Wed, 8 Jan 2003 11:08:52 +0100 (MET) Received: from kraid.nerim.net (smtp-101.nerim.net [62.4.16.101]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h08A8m503277 for ; Wed, 8 Jan 2003 11:08:50 +0100 (MET) Received: from hector.lesours (lesours.starynkevitch.net [80.65.224.217]) by kraid.nerim.net (Postfix) with ESMTP id 1580640F4A; Wed, 8 Jan 2003 10:56:40 +0100 (CET) Received: from basile by hector.lesours with local (Exim 3.36 #1 (Debian)) id 18WD8h-0006py-00; Wed, 08 Jan 2003 11:08:47 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <15899.63661.698094.412051@hector.lesours> Date: Wed, 8 Jan 2003 11:08:45 +0100 To: Mikkel Christiansen Cc: caml-list@inria.fr Subject: [Caml-list] Buffer.add error In-Reply-To: <3E1BF50A.7070401@cs.auc.dk> References: <3E1BF50A.7070401@cs.auc.dk> X-Mailer: VM 7.07 under Emacs 21.2.2 From: Basile STARYNKEVITCH Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>>>> "Mikkel" == Mikkel Christiansen writes: Mikkel> Hi I'm having trouble with the buffer library in ocaml Mikkel> (version 3.06 - debian). Program was compiled to native Mikkel> using ocamlopt. Mikkel> When generating a rather large string I get the following Mikkel> error: Mikkel> Fatal error: exception Failure("Buffer.add: cannot Mikkel> grow buffer") Mikkel> Is there any way to avoid this (except writing directly to Mikkel> a file)? I suggest looking into the sources. In ocaml/stdlib/buffer.ml you can read (near line 43) if b.position + more <= 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: basilestarynkevitchnet alias: basiletunesorg 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