comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: function "&" for strings type cause memory problem.
Date: Thu, 10 Nov 2005 20:45:17 GMT
Date: 2005-11-10T20:45:17+00:00	[thread overview]
Message-ID: <xjOcf.200$c27.19@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <dkv059$hit$1@netnews.hinet.net>

bubble wrote:

     type access_string is access all String;
>    String1 : String := (1 .. 10_000_000 => 'a');
>    String2 : String := (1 .. 10_000_000 => 'b');
> 
>       Nstring2 := new String'(String1 & String2);

"&" is probably creating its result on the stack, and there's not enough space 
for a 20-million-character string on your stack, resulting in Storage_Error. You 
can check the GNAT sources if you want to be sure.

You could allocate the space and copy the 2 strings in separately, similar to 
what you do in your 1st test.

Do you really have 10-million-character strings, or are you allocating enough 
for the maximum from VB? If the latter, you can allocate just the amount you 
need. Ada is good at that.

-- 
Jeff Carter
"It's symbolic of his struggle against reality."
Monty Python's Life of Brian
78



  parent reply	other threads:[~2005-11-10 20:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10  8:25 function "&" for strings type cause memory problem bubble
2005-11-10  9:01 ` Alex R. Mosteo
2005-11-10  9:23 ` Dmitry A. Kazakov
2005-11-10 18:04 ` tmoran
2005-11-10 20:45 ` Jeffrey R. Carter [this message]
2005-11-11  8:25 ` bubble
2005-11-11  9:43   ` Dmitry A. Kazakov
2005-11-11 11:55     ` bubble
2005-11-11 13:45       ` Dmitry A. Kazakov
2005-12-01  0:18         ` Randy Brukardt
replies disabled

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