From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p04FELa5004247 for ; Tue, 4 Jan 2011 16:14:26 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArAAAMvHIk3RVdQ2kGdsb2JhbACVa4YzAYgSCBUBAQEBCQkMBxEEIKMAiXeCGIUMLoZOAQEDBYVFBIFgiSeGEg X-IronPort-AV: E=Sophos;i="4.60,272,1291590000"; d="scan'208";a="93763118" Received: from mail-vw0-f54.google.com ([209.85.212.54]) by mail1-smtp-roc.national.inria.fr with ESMTP; 04 Jan 2011 16:14:25 +0100 Received: by vws9 with SMTP id 9so6035070vws.27 for ; Tue, 04 Jan 2011 07:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=MciHHtoAAqMHAAlS4eNCMOm25aswxG4NjAluWqqRmt4=; b=SI7FepM5lwvcwKj2DlNrTeHbU+kOLEMmOSY9wTAne/zR8q78IuaWQHouP7i1zlO4vM 75Acoey29JDl0otbu48Vvm2j6KO5iPvF2SXs4Y0fVHLDJB8baY6GkR+biaRtx5tNXbkG 30jh3/ssdqoOLAHLBcFoCGHLCzMvJUPgw40l4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=Hgqg/teb8IIzakOe1RykFXxs0radSUq/ici1Z+JLl/D7Uz2YsqXLB7ec3gDoK9ByfO cggQJQbfqk0f89KpJSdNE1FQ6JW52SJp2sKFuFh855pnotN5nFGV8d9jD1o7stshtisG KvVaEhBoJpg7os1KKvui2Um5yhsfjGDRIecyg= Received: by 10.229.236.193 with SMTP id kl1mr20135440qcb.114.1294154065050; Tue, 04 Jan 2011 07:14:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.98.203 with HTTP; Tue, 4 Jan 2011 07:14:04 -0800 (PST) In-Reply-To: <4D23353C.8020803@gmail.com> References: <4D23353C.8020803@gmail.com> From: Jean Krivine Date: Tue, 4 Jan 2011 16:14:04 +0100 Message-ID: To: =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016e64ca45a54fc04049906b9e4 Subject: Re: [Caml-list] Array.make exception and parser --0016e64ca45a54fc04049906b9e4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks, it seems the exception is raised by the function grow_stacks() in the 'Parsing' module of Ocaml (not mine). Indeed, looking at the code I can see several calls to Array.create that are not encapsulated in a try .. with. Isn't that a bug ? Anyway I think I found the answer of my problem. Cheers! 2011/1/4 T=F6r=F6k Edwin > On 2011-01-04 15:41, Jean Krivine wrote: > > Hi all, > > > > I am encountering a weird problem, I am trying to parse a very large fi= le > > (around 1.2 GB) according to a grammar defined in ocamlyacc. > > On a 32-bit or 64-bit architecture? > > > During the parsing I get the exception > > > > Invalid_argument "Array.make". > > > > This is strange because I am not using any array. > > You can try calling 'Printexc.record_backtrace true' on startup, and > compile with -g. If you compile to bytecode the stacktrace will usually > be better, but that is not always accurate either. > > Another way is to run your bytecode in ocamldebug, and use 'backstep' > from the point where exception is raised. > > > My guess it that a big chunk of the file I am parsing is matching a non > > terminal, something like > > > > rule: > > non_term END {blah}; > > > > where non_term is going to be 1GB of characters. Does anyone know what > > could be raising the exception ? > > Trying to allocate a too big array: > > #ifdef ARCH_SIXTYFOUR > #define Max_wosize (((intnat)1 << 54) - 1) > #else > #define Max_wosize ((1 << 22) - 1) > #endif > if (wsize > Max_wosize) caml_invalid_argument("Array.make"); > > > > Thanks! > > J > > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > --0016e64ca45a54fc04049906b9e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks, it seems the exception is raised by the function grow_stacks() in t= he 'Parsing' module of Ocaml (not mine).
Indeed, looking at the = code I can see several calls to Array.create that are not encapsulated in a= try .. with. Isn't that a bug ?

Anyway I think I found the answer of my problem.

Cheers!

=
2011/1/4 T=F6r=F6k Edwin <<= a href=3D"mailto:edwintorok@gmail.com">edwintorok@gmail.com><= br>
On 2011-01-04 15:41, Jean Krivine wrote:
> Hi all,
>
> I am encountering a weird problem, I am trying to parse a very large f= ile
> (around 1.2 GB) according to a grammar defined in ocamlyacc.

On a 32-bit or 64-bit architecture?

> During the parsing I get the exception
>
> Invalid_argument "Array.make".
>
> This =A0is strange because I am not using any array.

You can try calling 'Printexc.record_backtrace true' on start= up, and
compile with -g. If you compile to bytecode the stacktrace will usually
be better, but that is not always accurate either.

Another way is to run your bytecode in ocamldebug, and use 'backstep= 9;
from the point where exception is raised.

> My guess it that a big chunk of the file I am parsing is matching a no= n
> terminal, something like
>
> rule:
> non_term END {blah};
>
> where non_term is =A0going to be 1GB of characters. Does anyone know w= hat
> could be raising the exception ?

Trying to allocate a too big array:

#ifdef ARCH_SIXTYFOUR
#define Max_wosize (((intnat)1 << 54) - 1)
#else
#define Max_wosize ((1 << 22) - 1)
#endif
=A0 =A0if (wsize > Max_wosize) caml_invalid_argument("Array.make&q= uot;);
>
> Thanks!
> J
>


--
Caml-list mailing list. =A0Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--0016e64ca45a54fc04049906b9e4--