Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004405OCaml~DO NOT USE (was: OCaml general)public2007-09-25 18:472014-12-14 17:22
Assigned To 
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version3.10.0 
Target VersionFixed in Version 
Summary0004405: ocamlopt, ocaml, ocamlc, Stack Overflow on large hardcoded arrays.
DescriptionIf 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, has a single 274 896 arrays and will crash all the aforementioned programs, whereas has splitted the array in five parts and doesn't crash (and, FWIW, can Array.iter and Array.get without trouble).
Additional InformationWindows X86, OCaml 3.10.0 / MinGW.
TagsNo tags attached.
Attached Filesbz2 file icon stack.tar.bz2 [^] (65,498 bytes) 2007-09-25 18:47

- Relationships
has duplicate 0006713closedgasche Long compiles (to bytecode) / stackoverflow (to native code) on generated data 
related to 0005844resolvedgasche stack overflow compiling medium size list constants 
related to 0005925resolvedgasche Stack overflow in compiler 

-  Notes
thelema (reporter)
2007-11-02 20:01

Can't reproduce: Using mandriva build of ocaml 3.10.0, 'ocamlc' produces a perfectly good a.out file, without crashing. This is on 32-bit linux x86.
xleroy (administrator)
2007-11-06 16:27

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.

- Issue History
Date Modified Username Field Change
2007-09-25 18:47 vbigiani New Issue
2007-09-25 18:47 vbigiani File Added: stack.tar.bz2
2007-11-02 20:01 thelema Note Added: 0004233
2007-11-06 16:27 xleroy Note Added: 0004237
2007-11-06 16:27 xleroy Status new => closed
2007-11-06 16:27 xleroy Resolution open => no change required
2012-12-05 11:34 gasche Relationship added related to 0005844
2013-02-18 11:27 gasche Relationship added related to 0005925
2014-12-14 17:22 gasche Relationship added has duplicate 0006713
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker