From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Storage_Size in a Simple Program Date: Thu, 25 Oct 2018 16:56:45 +0100 Organization: A noiseless patient Spider Message-ID: References: <1nx0yp3.x6ss3k18nq71lN%csampson@inetworld.net> <1nx5k9a.1n8zqjs1xf0pe6N%csampson@inetworld.net> <50b40e43-623a-4015-95b3-91c5d4736e53@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="c02a27e460a092afce98c2f3a8ef75dc"; logging-data="13967"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mtxhPdI1EvrkKkPpYmSvy4dDvGwGNrYg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:COe/hMqtId/K/YoqveAURDudMf8= sha1:7/mHAnAVcPLYUNFsc7+OZuUNE4M= Xref: reader02.eternal-september.org comp.lang.ada:54706 Date: 2018-10-25T16:56:45+01:00 List-Id: joakimds@kth.se writes: >> That said, I would welcome a standard Ada way to specify the stack >> size for the environment task. Perhaps Storage_Size could be >> specified for the main subprogram, in the same way as the Priority >> for the environment task. > > At > "http://www.adaic.org/resources/add_content/standards/05aarm/html/AA-D-1.html" > one can read: Likewise, the priority value is associated with the > environment task if the pragma appears in the declarative_part of the > main subprogram. > > Therefore, specifying Storage_Size for the main subprogram as can be > done with Priority should be technically possible. On the other hand, I just tried with Ada.Text_IO; use Ada.Text_IO; with Interfaces; procedure Main_Stack is Size : Natural := 16; type Arr is array (Natural range <>) of Interfaces.Unsigned_8; begin loop Put_Line ("trying size" & Size'Image); declare A : Arr (1 .. Size) := (others => 0); begin A (A'Last) := 42; end; Size := Size * 2; end loop; end Main_Stack; on this Mac (High Sierra, 8GB RAM) and it failed at 8 Mb. (ulimit -s says 8192k). If I say ulimit -s 16384, it fails at 16 Mb. Since the main program's stack limit is determined by the OS, I don't see how an Ada aspect/pragma can affect it.