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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Dynamic allocation in the predefined language environment Date: Tue, 7 Jul 2015 10:46:16 +0200 Organization: cbb software GmbH Message-ID: <15qzm7ya25iur.127dec8vsiaff.dlg@40tude.net> References: <559a623d$0$293$14726298@news.sunsite.dk> <1m8r6qty3qecf.1l9e7pzo3lg8p.dlg@40tude.net> <559b8bec$0$294$14726298@news.sunsite.dk> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: enOx0b+nfqkc2k+TNpOejg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:26676 Date: 2015-07-07T10:46:16+02:00 List-Id: On Tue, 07 Jul 2015 08:23:25 +0000, Matthias-Christian Ott wrote: > On 07/07/15 07:42, Dmitry A. Kazakov wrote: >> On Mon, 06 Jul 2015 11:13:17 +0000, Matthias-Christian Ott wrote: >> >>> I need to store strings of unknown length. For security reasons I set >>> limits for the types of strings the software handles and I used >>> bounded-length strings to store them. >> >> Why don't you use plain strings allocated in an arena pool? Usually this >> covers most of cases where you need controlled allocation of constant and >> semi-constant strings. > > I could this, but then I would have to implement reference counting as > well or do manual memory management with all its disadvantages. and advantages. An arena or LIFO pool assumes that you deallocate strings by groups. There are very few cases when strings are deallocated at all and even fewer ones when they are deallocated randomly. If you indeed have safety concerns, then that must certainly apply to your case. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de