comp.lang.ada
 help / color / mirror / Atom feed
From: Johan Groth <jgroth@xpress.se>
Subject: Re: Large strings in ADA
Date: 2000/04/17
Date: 2000-04-17T16:59:20+00:00	[thread overview]
Message-ID: <38FB4521.D02EA4C9@xpress.se> (raw)
In-Reply-To: I0vK4.1823$lM4.428284@news.pacbell.net

tmoran@bix.com wrote:
> 
> >Perhaps you should try duplicating the -exact- C semantics. Presumably
> >you have a -very- large char buffer into which the items are copied.
> 
>   If the original is in C, it must have something like
>      char Msg[2500000];  // 2.5 MB
> so the straightforward Ada equivalent would be
>      Msg : String(1 .. 2_500_000);  -- 2.5 MB

The above is the current solution but it doesn't work as it uses to much
memory. The C-program reallocates the buffer only if the string added to
it exceeds its current size and if it reallocates it grows with a power
of 2. So if the buffer was 8 bytes big and you added 9 bytes the buffer
would become 32 bytes big.

So I will try to use the C-sematics and let the message-buffer grow the
same way and use replace_slice to add the string to the buffer.

/Johan

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   "Better to ask questions and seem stupid
    than not to ask questions and remain stupid" -Unknown
           Johan Groth <jgroth@xpress.se> Kupolen Data




  reply	other threads:[~2000-04-17  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-16  0:00 Large strings in ADA Johan Groth
2000-04-16  0:00 ` David Starner
2000-04-17  0:00 ` Dale Stanbrough
2000-04-17  0:00   ` tmoran
2000-04-17  0:00     ` Johan Groth [this message]
2000-04-17  0:00       ` tmoran
2000-04-18  0:00         ` tmoran
2000-04-22  0:00           ` Johan Groth
2000-04-17  0:00       ` Florian Weimer
2000-04-17  0:00       ` Robert Dewar
2000-04-17  0:00         ` David Starner
2000-04-17  0:00 ` Robert Dewar
2000-04-17  0:00 ` Florian Weimer
2000-04-17  0:00 ` Robert Dewar
replies disabled

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