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!
On 2011-01-04 15:41, Jean Krivine wrote:On a 32-bit or 64-bit architecture?
> 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.
You can try calling 'Printexc.record_backtrace true' on startup, and
> During the parsing I get the exception
>
> Invalid_argument "Array.make".
>
> This is strange because I am not using any array.
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.
Trying to allocate a too big array:
> 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 ?
#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