caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean Krivine <jean.krivine@gmail.com>
To: "Török Edwin" <edwintorok@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Array.make exception and parser
Date: Tue, 4 Jan 2011 16:14:04 +0100	[thread overview]
Message-ID: <AANLkTimtwMLh=54+Pe5413o=gxU16P=6d+cU0cBKmfqP@mail.gmail.com> (raw)
In-Reply-To: <4D23353C.8020803@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]

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örök Edwin <edwintorok@gmail.com>

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

[-- Attachment #2: Type: text/html, Size: 2698 bytes --]

  reply	other threads:[~2011-01-04 15:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04 13:41 Jean Krivine
2011-01-04 14:56 ` Daniel Bünzli
2011-01-04 14:57   ` Daniel Bünzli
2011-01-04 14:57 ` Török Edwin
2011-01-04 15:14   ` Jean Krivine [this message]
2011-01-04 15:31     ` Daniel Bünzli
2011-01-04 16:22       ` Yitzhak Mandelbaum
2011-01-04 16:42         ` Daniel Bünzli
2011-01-04 17:03           ` Yitzhak Mandelbaum
2011-01-04 17:04       ` Jean Krivine
2011-01-04 17:22         ` Daniel Bünzli
2011-01-04 15:38     ` bluestorm
2011-01-04 17:43       ` Jean Krivine
     [not found]       ` <1125074892.441923.1294163043602.JavaMail.root@zmbs2.inria.fr>
2011-01-04 17:53         ` Francois Pottier
     [not found]     ` <1259991756.440008.1294155536392.JavaMail.root@zmbs2.inria.fr>
2011-01-04 17:45       ` Francois Pottier
2011-01-04 19:30         ` Daniel Bünzli
2011-01-04 19:52           ` Yitzhak Mandelbaum
2011-01-04 20:36             ` Daniel Bünzli
     [not found]         ` <1263353434.442766.1294169448342.JavaMail.root@zmbs2.inria.fr>
2011-01-04 20:31           ` Francois Pottier
2011-01-04 20:40             ` Lukasz Stafiniak
2011-01-04 21:03               ` Török Edwin
2011-01-05  3:24                 ` Yitzhak Mandelbaum
2011-01-05 14:12             ` Boris Yakobowski
2011-01-05 21:12             ` Boris Yakobowski
2011-01-05 13:37 ` Xavier Leroy
2011-01-05 13:46   ` Jean Krivine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimtwMLh=54+Pe5413o=gxU16P=6d+cU0cBKmfqP@mail.gmail.com' \
    --to=jean.krivine@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=edwintorok@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).