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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ae395e5c11de7bc9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!k6g2000prg.googlegroups.com!not-for-mail From: Jerry Newsgroups: comp.lang.ada Subject: Re: segfault with large-ish array with GNAT Date: Wed, 17 Mar 2010 23:45:25 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <642ddf8b-1d45-4f74-83ad-2c755040ca33@k24g2000pro.googlegroups.com> <4ba13454$0$6720$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 75.172.190.146 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1268894725 9592 127.0.0.1 (18 Mar 2010 06:45:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Mar 2010 06:45:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k6g2000prg.googlegroups.com; posting-host=75.172.190.146; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/528.16+(KHTML, like Gecko, Safari/528.16) OmniWeb/v622.8.0,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:10613 Date: 2010-03-17T23:45:25-07:00 List-Id: Thanks for the helpful comments. First, ulimit -s unlimited does not work on OS X: -bash: ulimit: stack size: cannot modify limit: Operation not permitted but I understand that it works on Linux. And possibly the reason is the difference in the way that Linux and OS X treat stack and heap memory. (Don't be confused and think I know what I'm talking about but I read that somewhere.) ulimit allows querying the hard limit of stack space ulimit -Hs which on OS X reports 65532 = 2^16 -4 kilobytes, about 67 MB. The user via ulimit can set the stack up to that size but not higher: ulimit -s 65532 The default soft limit on OS X is 8192 kB, found by ulimit -s So here's me being naive: I would have thought that Ada (or GNAT specifically) would be smart enough to allocate memory for large objects such as my long array in a transparent way so that I don't have to worry about it, thus (in the Ada spirit) making it harder to screw up. (Like not having to worry about whether arguments to subprograms are passed by value or by reference--it just happens.) But it seems that I will have to allocate memory for large objects using pointers (and thus take the memory from the heap). Is that right? In this context, is there any advantage to declaring the large object inside a declare block? Would that force the memory to be allocated from the heap? Jerry