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!t-online.de!nntp.theplanet.net!inewsm1.nntp.theplanet.net!pe2.news.blueyonder.co.uk!blueyonder!pe1.news.blueyonder.co.uk!blueyonder!news-out.ntli.net!newsrout1-gui.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe1-win.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: very long string and Segmentation fault User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-ID: Newsgroups: comp.lang.ada References: <1152261569.199484.272250@m73g2000cwd.googlegroups.com> <2518982.DQdlQZ4ST9@linux1.krischik.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Fri, 07 Jul 2006 19:17:16 GMT NNTP-Posting-Host: 82.10.238.153 X-Trace: newsfe1-win.ntli.net 1152299836 82.10.238.153 (Fri, 07 Jul 2006 20:17:16 BST) NNTP-Posting-Date: Fri, 07 Jul 2006 20:17:16 BST Organization: NTL Xref: g2news2.google.com comp.lang.ada:5558 Date: 2006-07-07T19:17:16+00:00 List-Id: 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. -- Adrian