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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c32f6f0b23106020 X-Google-Attributes: gid103376,public From: Johan Groth Subject: Re: Large strings in ADA Date: 2000/04/17 Message-ID: <38FB4521.D02EA4C9@xpress.se>#1/1 X-Deja-AN: 612303609 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en, sv Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@algo.net X-Trace: cubacola.tninet.se 955990760 8252 195.162.64.180 (17 Apr 2000 16:59:20 GMT) Organization: Telenordia Mime-Version: 1.0 NNTP-Posting-Date: 17 Apr 2000 16:59:20 GMT Newsgroups: comp.lang.ada Date: 2000-04-17T16:59:20+00:00 List-Id: 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 Kupolen Data