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,590105a5ce7f98b5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed01.chello.at!newsfeed02.chello.at!news.hispeed.ch.POSTED!not-for-mail Message-ID: <5804618.FkKYG9Xm5Y@linux1.krischik.com> From: Martin Krischik Subject: Re: very long string and Segmentation fault Newsgroups: comp.lang.ada Date: Sat, 08 Jul 2006 07:01:59 +0200 References: <1152261569.199484.272250@m73g2000cwd.googlegroups.com> <2518982.DQdlQZ4ST9@linux1.krischik.com> User-Agent: KNode/0.10.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@hispeed.ch Organization: hispeed.ch NNTP-Posting-Host: 80.218.119.160 (80.218.119.160) NNTP-Posting-Date: Sat, 08 Jul 2006 07:30:15 +0200 X-Trace: 13c0844af42e7f57fd20502835 Xref: g2news2.google.com comp.lang.ada:5565 Date: 2006-07-08T07:01:59+02:00 List-Id: Dr. Adrian Wrigley wrote: > On Fri, 07 Jul 2006 20:24:52 +0200, Martin Krischik wrote: > >> zychp@o2.pl wrote: >> >>> I have problem with creating very long strings. When I try to create >>> string bigger than 5MB I get Segmentation fault. >> >> Well, you should not ;-) - its certainly a compiler bug. > > Actually, I think it is more of a feature(?) > > I first hit this with GNAT 3.15p (Linux). I think the explanation > was that the "new" was allocated on the stack when the data weren't > being kept after the function returns. It's called "optimization", > apparently. I had to resort to various tricks to get it to use > heap allocation instead. (making the size non-static might help. > Calling malloc instead works.) Very messy. Library Level access type ??? Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com