From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: very long string and Segmentation fault
Date: Fri, 7 Jul 2006 21:38:34 +0200
Date: 2006-07-07T21:38:18+02:00 [thread overview]
Message-ID: <14rcl761v3zf1$.14pu8liretk7v.dlg@40tude.net> (raw)
In-Reply-To: pan.2006.07.07.19.15.40.699002@linuxchip.demon.co.uk.uk.uk
On Fri, 07 Jul 2006 19:17:16 GMT, 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.
Hmm, and the pointer wasn't "access all?" I mean, if the pointer were
pool-specific, then GNAT wouldn't have right to do such optimization. Then,
[if that doesn't help] it is quite straightforward to write a storage pool
with Allocate sucking memory from the heap.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2006-07-07 19:38 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
2006-07-07 19:38 ` Dmitry A. Kazakov [this message]
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