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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4dfbb9c23c9a83eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Sun, 07 Aug 2005 10:15:52 -0500 Newsgroups: comp.lang.ada Subject: Re: Please, help me. References: <27c5ecc06ac6a213466ab65361d20376@localhost.talkaboutprogramming.com> <2db7e95053c018032e212a9f7c2c614d@localhost.talkaboutprogramming.com> <7c45f5545bccb1eee77f20551a24c8a6@localhost.talkaboutprogramming.com> <97GdnZ2dnZ1c-rnynZ2dnRqLa9-dnZ2dRVn-y52dnZ0@comcast.com> From: Ludovic Brenta Date: Sun, 07 Aug 2005 17:16:58 +0200 Message-ID: <87psspvkt1.fsf@tiscali.be> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:4UhEffs910boz7gPIAIGifr99F8= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 83.134.239.248 X-Trace: sv3-nMzamnzMw7YmlLcPbLHUF6/Xr99SOs2V6GqGi3Wm70ioRaamh6dyYZNCdADJCFWGPxc6iWODeuSMloC!LJFfxm/5SeC/TyFskxaWdSwGh7F3U/109Rs4l1fQCJwl+5wMIj9DBY7uNcHtSycw X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:4017 Date: 2005-08-07T17:16:58+02:00 List-Id: Jeff Creem writes: [...] > If there is a set of large variables within the > > procedure blah is > large variables > > begin > > end; > > then moving all of the large variables to a package spec that the > procedure blah withs will reduce the stack space. > > If it is the sum of lots of littler things through the program then > perhaps using the storage_size attribute on a new task that does all > of the real work of the program (with the main thread just > terminating) will work. I have observed that array or record aggregates tend to be allocated on the stack, too. Array aggregates are particularly surprising since they're easy to replace with loops. For example: procedure Proc is type T is array (1 .. 100_000) of Integer; A : T; begin A := (others => 42); end Proc; allocates two large arrays on the stack (A and the aggregate) with some compilers I've used. In contrast: procedure Proc is type T is array (1 .. 100_000) of Integer; A : T; begin for J in A'Range loop A (J) := 42; end loop; end Proc; allocates just one array on the stack. Back on topic, setting the stack size depends on the target operating system and on the host linker. There are even situations where it is not possible to set the stack size at all. -- Ludovic Brenta.