> What command line parameter do I need with Gnat 3.15p to increase the
> main program's stack size?
-largs -Wl,--stack=0x1000000
see the GNAT User's Guide: 5.3 Setting Stack Size from gnatlink
(e.g.:
http://beru.univ-brest.fr/~singhoff/DOC/LANG/ADA/gnat_ugn_6.html#SEC81
)
HTH, Gautier
______________________________________________________________
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
gnatmake big -largs -Wl,--stack=0x1000000
works for a parameter of 4022 but gives:
raised STORAGE ERROR : EXCEPTION_STACK_OVERFLOW
with a parameter >= 4023, while either of
gnatmake big -largs -Wl,--stack=0x2000000
gnatmake big -largs -Wl,--stack=0x8000000
work for 4023 .. 4025 but 4026 again gives:
First, what is OS are you interested in?
The normal way, going from memory, is:
...
end big;
pragma main(stack_size=>20000000); --for a 20 meg stack.
However there are caveats on some common platforms like the Mac and
Windows. With Windows you also have to do some linker arguments,
which should be explained in the GNAT documentation.
With OS X, my experimentation earlier this year shows a fairly limited
stack size, which make code using large stacks problematic.
For your example above, using access types would appear to be the best
solution. Then, it is less dependent on stack sizes, no matter the
OS.
--
Try moving your code out of the main task and giving a pragma Storage_Size
for the new task.
You still need the linker commands, however.
For what's it worth, I just installed Gnat 2006 for Windows, and
converted your test procedure. By using the -Xlinker
--stack=0x10000000 on it, I was able to successfully run big 64000 on
XP (technically, Tablet PC).
So either you need to use the -Xlinker variant, or there is a
limitation in the 3.15 version of the compiler. Or you are using an
older version of Windows that doesn't support this.
--
Then it is either your version of Windows (XP? 2000?), or the gnat
version.
--
> So it appears that a simple program that does not use tasks or access
> types is limited to under 4 megabytes of data with Gnat 3.15p on Windows?
This paragraph from the user's guide (2006 GPL edition) applies here. Check
the corresponding one of 3.15p.
"For declared tasks, the stack size is controlled by the size given in an
applicable Storage_Size pragma or by the value specified at bind time with
`-d' (see section 4.2 Switches for gnatbind) or is set to the default size
as defined in the GNAT runtime otherwise.
For the environment task, the stack size depends on system defaults and is
unknown to the compiler. Stack checking may still work correctly if a fixed
size stack is allocated, but this cannot be guaranteed. To ensure that a
clean exception is signalled for stack overflow, set the environment
variable GNAT_STACK_LIMIT to indicate the maximum stack area that can be
used, as in:"