You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4405 Reporter: vbigiani Status: closed (set by @xavierleroy on 2007-11-06T15:27:06Z) Resolution: not a bug Priority: normal Severity: crash Version: 3.10.0 Category: ~DO NOT USE (was: OCaml general) Has duplicate:#6713 Related to:#5844#5925 Monitored by: thelema vbigiani
Bug description
If a .ml file contains an array that is of large size, ocamlopt(.opt).exe, ocaml.exe and ocamlc.(opt).exe all crash with a Stack Overflow exception. It happens if the array has 274 896 elements, but not if it has 60 000 elements. If I split the array in smaller parts and then I call Array.concat to merge them into the original array, the resulting program will work correctly.
In the attachment, crash.ml has a single 274 896 arrays and will crash all the aforementioned programs, whereas no-crash.ml has splitted the array in five parts and doesn't crash (and, FWIW, can Array.iter and Array.get without trouble).
Can't reproduce: Using mandriva build of ocaml 3.10.0, 'ocamlc crash.ml' produces a perfectly good a.out file, without crashing. This is on 32-bit linux x86.
The compilers use stack space proportional to the size of the array expression. So, yes, you can get stack overflow conditions at compile-time. With the "non-opt" compilers ocamlc, ocamlopt, you can easily increase the stack space available to the compiler: set the OCAMLRUNPARAM environment variable to e.g.
"l=10M" (10 mega-words of stack space, instead of the default 1 mega-words).
Increasing the stack space for ocamlc.opt and ocamlopt.opt is OS-dependent and is not possible under Windows as far as I know.
Original bug ID: 4405
Reporter: vbigiani
Status: closed (set by @xavierleroy on 2007-11-06T15:27:06Z)
Resolution: not a bug
Priority: normal
Severity: crash
Version: 3.10.0
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #6713
Related to: #5844 #5925
Monitored by: thelema vbigiani
Bug description
If a .ml file contains an array that is of large size, ocamlopt(.opt).exe, ocaml.exe and ocamlc.(opt).exe all crash with a Stack Overflow exception. It happens if the array has 274 896 elements, but not if it has 60 000 elements. If I split the array in smaller parts and then I call Array.concat to merge them into the original array, the resulting program will work correctly.
In the attachment, crash.ml has a single 274 896 arrays and will crash all the aforementioned programs, whereas no-crash.ml has splitted the array in five parts and doesn't crash (and, FWIW, can Array.iter and Array.get without trouble).
Additional information
Windows X86, OCaml 3.10.0 / MinGW.
File attachments
The text was updated successfully, but these errors were encountered: