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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,da39df064d0b18d7 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!24g2000yqm.googlegroups.com!not-for-mail From: Vadim Godunko Newsgroups: comp.lang.ada Subject: Re: GNAT's stack checking in Ubuntu 9.04 (and Shootout regex-dna) Date: Tue, 4 Aug 2009 05:30:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2b246c40-ef58-4845-8940-5c9ec176a292@24g2000yqm.googlegroups.com> References: <4a776a94$0$31878$9b4e6d93@newsspool3.arcor-online.net> <4a776b25$0$31878$9b4e6d93@newsspool3.arcor-online.net> <47559b1f-cb97-455b-b76d-98a4f8a834ac@f37g2000yqn.googlegroups.com> <4a77fcc3$0$30229$9b4e6d93@newsspool1.arcor-online.net> <7d604363-8623-4146-8aa5-9a7ec729023b@j21g2000yqe.googlegroups.com> <4a781100$0$30236$9b4e6d93@newsspool1.arcor-online.net> NNTP-Posting-Host: 93.178.79.224 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1249389008 2646 127.0.0.1 (4 Aug 2009 12:30:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 4 Aug 2009 12:30:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 24g2000yqm.googlegroups.com; posting-host=93.178.79.224; posting-account=niG3UgoAAAD7iQ3takWjEn_gw6D9X3ww User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.12) Gecko/2009071200 SUSE/3.0.12-0.1.2 Firefox/3.0.12,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7569 Date: 2009-08-04T05:30:07-07:00 List-Id: On Aug 4, 2:44=A0pm, Georg Bauhaus wrote: > It hits the limit exaclty when the array of 625_000 > default initialized Vstrings is allocated on the stack. > No operations performed at that point. > > > Unbounded_String uses constant size of stack for object itself and > > uses dynamic size on heap for actual value. > > Yes. How much does a default initialized Unbounded_String > use when it is an array component? (I'll debug this when > there is more time; just in case you happen to know, > would be most helpful.) > Its very easy to discover: with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package Tst is type T is array (Positive range <>) of Unbounded_String; X : T (1 .. 625_000); end Tst; > gcc -c -gnatR3 tst.ads Representation information for unit Tst (spec) ---------------------------------------------- for T'Alignment use 16; for T'Component_Size use 512; for X'Size use 320000000; for X'Alignment use 16; So, on my platform (OpenSUSE Linux/x86_64) array of Unbounded_String with 625_000 components occupy approximately 40Mb.