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=-0.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,126b9ecb088e6bfd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-13 11:20:06 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!feeder2-1.proxad.net!news3-2.free.fr!not-for-mail From: "Alex Xela" Newsgroups: comp.lang.ada References: <3f8904a1$0$10406$626a54ce@news.free.fr> <3F89E26E.40705@comcast.net> Subject: Re: using 'storage_size ? Date: Mon, 13 Oct 2003 20:20:34 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 Message-ID: <3f8aecd5$0$13291$626a54ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 13 Oct 2003 20:20:05 MEST NNTP-Posting-Host: 81.56.190.34 X-Trace: 1066069205 news3-2.free.fr 13291 81.56.190.34:1562 X-Complaints-To: abuse@proxad.net Xref: archiver1.google.com comp.lang.ada:781 Date: 2003-10-13T20:20:05+02:00 List-Id: ------------- Yes, but the gnat strategy should not matter with the fact that when I define a pool of 8 Mo, I should be able to allocate at least 5Mo. Alex. ------------- "Robert I. Eachus" a �crit dans le message de news: 3F89E26E.40705@comcast.net... > Alex Xela wrote: > > > > with ada.text_io,Unchecked_Deallocation,Ada.Exceptions; > > procedure garbage is > > ko : constant := 1024; > > Mo : constant := ko*ko; > ... > > declare > > type local_ptr is access tab_byte; > > for local_ptr'storage_size use Mo*8;--[line 20]GNAT 3.15p raised > > STORAGE_ERROR : EXCEPTION_STACK_OVERFLOW > > Read the fine manual. In this case the gnat_rm will point you to > System.Pool_Size in s-poosiz.ads which says: > > -------------------------------------------------------------------------- --- > ------------------------ > -- Stack_Bounded_Pool -- > ------------------------ > > -- Allocation strategy: > > -- Pool is a regular stack array, no use of malloc > -- user specified size > -- Space of pool is globally reclaimed by normal stack management > > -- Used in the compiler for access types with 'STORAGE_SIZE rep. clause > -- Only used for allocating objects of the same type. > > -------------------------------------------------------------------------- -- > > Translation, when you use 'Storage_Size in GNAT to set the storage for a > type, the compiler takes that as a directive to allocate a > local_ptr'storage_size array on the stack, in this case as part of the > stack frame for the declare block. If you comment the line out, the > storage designated by local_ptr values will be allocated on the heap > when new is called. > > I suspect that you need to grow the stack size if you want to grab a > megabyte in one chunk. > > -- > Robert I. Eachus > > "Quality is the Buddha. Quality is scientific reality. Quality is the > goal of Art. It remains to work these concepts into a practical, > down-to-earth context, and for this there is nothing more practical or > down-to-earth than what I have been talking about all along...the repair > of an old motorcycle." -- from Zen and the Art of Motorcycle > Maintenance by Robert Pirsig >