comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: very long string and Segmentation fault
Date: Fri, 07 Jul 2006 19:17:16 GMT
Date: 2006-07-07T19:17:16+00:00	[thread overview]
Message-ID: <pan.2006.07.07.19.15.40.699002@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: 2518982.DQdlQZ4ST9@linux1.krischik.com

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




  reply	other threads:[~2006-07-07 19:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07  8:39 very long string and Segmentation fault zychp
2006-07-07 18:24 ` Martin Krischik
2006-07-07 19:17   ` Dr. Adrian Wrigley [this message]
2006-07-07 19:38     ` Dmitry A. Kazakov
2006-07-08  5:01     ` Martin Krischik
2006-07-11  9:29 ` zychp
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox