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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:1647:: with SMTP id 68-v6mr3746434iow.107.1527794356235; Thu, 31 May 2018 12:19:16 -0700 (PDT) X-Received: by 2002:a9d:4795:: with SMTP id b21-v6mr332278otf.10.1527794356050; Thu, 31 May 2018 12:19:16 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feeder4.usenet.farm!feed.usenet.farm!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!85.12.16.70.MISMATCH!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u74-v6no1169746itb.0!news-out.google.com!b185-v6ni1231itb.0!nntp.google.com!v8-v6no1158131itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 31 May 2018 12:19:15 -0700 (PDT) In-Reply-To: <13ec49fb-8c1a-42a4-b1a2-3984d0e159f7@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a04:ae04:9408:b600:60b5:c067:c56b:2d50; posting-account=-SMKVgoAAAA8u8UnmI_NwOPA-LGqXugp NNTP-Posting-Host: 2a04:ae04:9408:b600:60b5:c067:c56b:2d50 References: <13ec49fb-8c1a-42a4-b1a2-3984d0e159f7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Memory pools From: gorgelo@hotmail.com Injection-Date: Thu, 31 May 2018 19:19:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2474 X-Received-Body-CRC: 190588275 Xref: reader02.eternal-september.org comp.lang.ada:52816 Date: 2018-05-31T12:19:15-07:00 List-Id: Den tisdag 29 maj 2018 kl. 21:41:14 UTC+2 skrev John Perry: > I apologize if this is a dumb question, but: >=20 > I've read that Ada uses memory pools for each type. When I read this, I t= hink it means, for instance, Ada sets up something like an array of 10000 e= lements for each type, and when the user asks to allocate a new object of s= uch-and-such type, the run-time system hands that to you. >=20 > Is that the idea, or do they mean something else? The pre-allocations scheme that you think of is the oldest form of memory p= ools in Ada, already offerred by many Ada 83 compilers and then included in= the Ada95 standard. It means that one allocates a bounded amount of memory= to an access type (pointer). The idea to do this originates from the obser= vation that an access type (pointer) does not need to have the same life-ti= me as the application. The idea is to define the access type in the beginni= ng of a subprogram and pre-allocate memory to it and then when the access t= ype goes out of scope all heap-memory is deallocation (RAII-pattern again).= This simple form of memory pool has since then been generalised.