comp.lang.ada
 help / color / mirror / Atom feed
* Gnat storage size
@ 2006-08-26 18:09 tmoran
  2006-08-26 18:46 ` Gautier
  2006-08-26 22:42 ` Kevin K
  0 siblings, 2 replies; 10+ messages in thread
From: tmoran @ 2006-08-26 18:09 UTC (permalink / raw)


What command line parameter do I need with Gnat 3.15p to increase the
main program's stack size?  I'm getting
raised STORAGE_ERROR : big.adb:4 object too large
when the command line parameter is >= 4026 with the program:
with ada.command_line;
procedure big is
  procedure try(k : in integer) is
    x : array(1 .. k*1042) of integer;
  begin
    x(1) := 0;
  end try;
begin
  try(integer'value(ada.command_line.argument(1)));
end big;



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-26 18:09 Gnat storage size tmoran
@ 2006-08-26 18:46 ` Gautier
  2006-08-26 19:26   ` tmoran
  2006-08-26 22:42 ` Kevin K
  1 sibling, 1 reply; 10+ messages in thread
From: Gautier @ 2006-08-26 18:46 UTC (permalink / raw)


tmoran@acm.org:

> 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!



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-26 18:46 ` Gautier
@ 2006-08-26 19:26   ` tmoran
  2006-08-28  6:26     ` Alex R. Mosteo
  2006-08-31  0:15     ` Kevin K
  0 siblings, 2 replies; 10+ messages in thread
From: tmoran @ 2006-08-26 19:26 UTC (permalink / raw)


> > 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

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:
raised STORAGE_ERROR : big.adb:4 object too large



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-26 18:09 Gnat storage size tmoran
  2006-08-26 18:46 ` Gautier
@ 2006-08-26 22:42 ` Kevin K
  1 sibling, 0 replies; 10+ messages in thread
From: Kevin K @ 2006-08-26 22:42 UTC (permalink / raw)


On Sat, 26 Aug 2006 18:09:56 UTC, tmoran@acm.org wrote:

> What command line parameter do I need with Gnat 3.15p to increase the
> main program's stack size?  I'm getting
> raised STORAGE_ERROR : big.adb:4 object too large
> when the command line parameter is >= 4026 with the program:
> with ada.command_line;
> procedure big is
>   procedure try(k : in integer) is
>     x : array(1 .. k*1042) of integer;
>   begin
>     x(1) := 0;
>   end try;
> begin
>   try(integer'value(ada.command_line.argument(1)));
> end big;


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.


-- 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-26 19:26   ` tmoran
@ 2006-08-28  6:26     ` Alex R. Mosteo
  2006-08-30  7:53       ` tmoran
  2006-08-31  0:15     ` Kevin K
  1 sibling, 1 reply; 10+ messages in thread
From: Alex R. Mosteo @ 2006-08-28  6:26 UTC (permalink / raw)


tmoran@acm.org wrote:

>> > 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
> 
> 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:
> raised STORAGE_ERROR : big.adb:4 object too large

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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-28  6:26     ` Alex R. Mosteo
@ 2006-08-30  7:53       ` tmoran
  2006-09-01 13:24         ` Alex R. Mosteo
  0 siblings, 1 reply; 10+ messages in thread
From: tmoran @ 2006-08-30  7:53 UTC (permalink / raw)


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?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-26 19:26   ` tmoran
  2006-08-28  6:26     ` Alex R. Mosteo
@ 2006-08-31  0:15     ` Kevin K
  2006-08-31  1:42       ` tmoran
  1 sibling, 1 reply; 10+ messages in thread
From: Kevin K @ 2006-08-31  0:15 UTC (permalink / raw)


On Sat, 26 Aug 2006 19:26:56 UTC, tmoran@acm.org wrote:

> > > 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
> 
> 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:
> raised STORAGE_ERROR : big.adb:4 object too large

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.

-- 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-31  0:15     ` Kevin K
@ 2006-08-31  1:42       ` tmoran
  2006-08-31 23:47         ` Kevin K
  0 siblings, 1 reply; 10+ messages in thread
From: tmoran @ 2006-08-31  1:42 UTC (permalink / raw)


> 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
I tried
gnatmake big -largs -Xlinker --stack=0x10000000
and it still says "object too large" when the command line argument is 4026.
I also tried not using gnatmake, but rather
gcc -c big
gnatbind -x big.ali
gnatlink big -Wl --stack=0x10000000
with the same result.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-31  1:42       ` tmoran
@ 2006-08-31 23:47         ` Kevin K
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin K @ 2006-08-31 23:47 UTC (permalink / raw)


On Thu, 31 Aug 2006 01:42:35 UTC, tmoran@acm.org wrote:

> > 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
> I tried
> gnatmake big -largs -Xlinker --stack=0x10000000
> and it still says "object too large" when the command line argument is 4026.
> I also tried not using gnatmake, but rather
> gcc -c big
> gnatbind -x big.ali
> gnatlink big -Wl --stack=0x10000000
> with the same result.

Then it is either your version of Windows (XP?  2000?), or the gnat 
version.

-- 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Gnat storage size
  2006-08-30  7:53       ` tmoran
@ 2006-09-01 13:24         ` Alex R. Mosteo
  0 siblings, 0 replies; 10+ messages in thread
From: Alex R. Mosteo @ 2006-09-01 13:24 UTC (permalink / raw)


tmoran@acm.org wrote:

> 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:"



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-09-01 13:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-26 18:09 Gnat storage size tmoran
2006-08-26 18:46 ` Gautier
2006-08-26 19:26   ` tmoran
2006-08-28  6:26     ` Alex R. Mosteo
2006-08-30  7:53       ` tmoran
2006-09-01 13:24         ` Alex R. Mosteo
2006-08-31  0:15     ` Kevin K
2006-08-31  1:42       ` tmoran
2006-08-31 23:47         ` Kevin K
2006-08-26 22:42 ` Kevin K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox