Hi
I use a Sun SPARC 5 running Solaris 2.5, and I have 32MB
of RAM on one machine. (Another server has 2 gigabytes of RAM).
I have an Ada program which tries to create a 3D array of
size 128 X 128 X 128 bins of Integers (4 byte types),
i.e. asks for 8 Megabytes of RAM.
I have written it two ways, one as normal (asking for
stack space) and one using pointers and new (asking for
heap) space.
Both programs crash giving Segmentation Fault!
(It says Storage_Error on a friend's old Ada compiler
as it should do (this means stack overflow), but nevermind.)
However, if I ask for a smaller array of size 85X85X85 bins say,
then all works fine!
I am told that the size of the stack allowed for the main program
can grow as big as it wants to be, limited only by the
hardware and operating system. Since I have access to a machine
with a big RAM (32 MB or more) and I am only asking for
8 Megs, I wish to know why I get this Segmentation Fault.
**The QUESTION
Can you tell me what the max size of the stack is
for a single executable program (or how I can find
it out for my machine + OS)?
AND
how I can ask for a bigger stack / make the stack bigger.
(I am assured that the compiler does not limit the max size of the
stack for the main program.)
Thanks in advance.
Will Berriss
--------------
--
Department of Engineering
The University of Reading
Whiteknights
Reading Tel: 0118 987 5123
Berkshire (+44 118 987 5123 outside UK)
RG6 6AY
England Fax: 0118 931 3327
World Wide Web Home Page:
http://www.elec.rdg.ac.uk/people/postgrads/will.html