From: "John B. Matthews" <nospam@nospam.com>
Subject: Re: How to set the stack size on GNAT (Follow-up)
Date: Sun, 07 Aug 2005 15:31:21 GMT
Date: 2005-08-07T15:31:21+00:00 [thread overview]
Message-ID: <nospam-A29489.11311207082005@news-rdr-03.ohiordc.rr.com> (raw)
In-Reply-To: 2db7e95053c018032e212a9f7c2c614d@localhost.talkaboutprogramming.com
In article
<2db7e95053c018032e212a9f7c2c614d@localhost.talkaboutprogramming.com>,
"Adaddict" <adaddict@hotmail.com> wrote:
> 2. -Xlstack=10485760
I think I proposed this one. It worked with GNAT 3.15 on Mac OS 9 with
MachTen or CodeBuilder. IIRC, the default stack size was just a few
kilobytes, so adjusting the stack size was sometimes hard to avoid.
> Could anyone tell me what am I doing wrong and what
> should I write exactly?
On Mac OS X, this should set the stack to 8 megabytes (the default):
gnatmake -f stack_test -largs --stack=0x800000
But you have to set "ulimit -s <decimal blocks of 1024 bytes>" in the
shell to make it work:
$ ulimit -s 8192
Here's my test program:
with Ada.Text_IO;
procedure Stack_Test is
Megabyte : constant Positive := 1024 * 1024;
type Block is array (0 .. Megabyte - 1) of Character;
procedure Allocate_Stack (N : Positive) is
Local : Block := (others => Character'Val(0));
begin
Ada.Text_IO.Put_Line (N'Img);
Allocate_Stack(N + 1);
end;
begin
Allocate_Stack(1);
end Stack_Test;
By default, the program dies after seven levels of recursion, as
expected. With "ulimit -s 16384" I get 15 levels before segmentation
fault.
What OS are you using?
--
John
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/
next prev parent reply other threads:[~2005-08-07 15:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-05 0:55 STORAGE_ERROR : EXCEPTION_STACK_OVERFLOW Adaddict
2005-08-05 1:21 ` Adaddict
2005-08-06 11:21 ` How to set the stack size on GNAT (Follow-up) Adaddict
2005-08-07 12:33 ` Please, help me Adaddict
2005-08-07 14:11 ` Jeff Creem
2005-08-07 14:51 ` Increasing stack size (was: Please, help me.) Larry Kilgallen
2005-08-07 15:16 ` Please, help me Ludovic Brenta
2005-08-07 15:31 ` John B. Matthews [this message]
2005-08-07 16:15 ` (Follow-up) Adaddict
2005-08-07 17:59 ` (Follow-up) Jeffrey Carter
2005-08-07 20:49 ` (Follow-up) Adaddict
2005-08-09 22:05 ` Follow up 2: raised STORAGE_ERROR : helper.adb:386 object too large Adaddict
2005-08-10 4:56 ` Jeff Creem
2005-08-10 17:44 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox