From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a37:8287:: with SMTP id e129mr7806288qkd.415.1631666383602; Tue, 14 Sep 2021 17:39:43 -0700 (PDT) X-Received: by 2002:a25:c6c1:: with SMTP id k184mr2641480ybf.277.1631666383403; Tue, 14 Sep 2021 17:39:43 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 14 Sep 2021 17:39:43 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=98.118.241.166; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 98.118.241.166 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <75749f8d-0f2c-45ef-b45f-fe55500d6bf8n@googlegroups.com> Subject: Re: Custom Storage Pool questions From: Jere Injection-Date: Wed, 15 Sep 2021 00:39:43 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:62741 List-Id: On Tuesday, September 14, 2021 at 2:08:49 AM UTC-4, J-P. Rosen wrote: > Le 14/09/2021 =C3=A0 02:48, Jere a =C3=A9crit :=20 > >>> In particular, the blog there advocates for separately counting for= =20 > >>> things like unconstrained array First/Last indices or the Prev/Next= =20 > >>> pointers used for Controlled objects. Normally I would have assumed= =20 > >>> that the Size_In_Storage_Elements parameter in Allocate would account= =20 > >>> for that, but the blog clearly shows that it doesn't=20 > >> [...]=20 > >>=20 > >> That blog shows a special use for Storage_Pools, where you allocate=20 > >> /user/ data on top of the requested memory. When called by the compile= r,=20 > >> it is up to the compiler to compute how much memory is needed, and you= r=20 > >> duty is to just allocate that.=20 > >>=20 > > Yes, but if you look at that blog, they are allocating space for the /u= ser/ data=20 > > and for the Next/Prev for controlled types and First/Last for unconstra= ined=20 > > arrays in addition to the size specified by allocate.=20 > >=20 > > I agree I feel it is up to the compiler to provide the correct size to = Allocate,=20 > > but the blog would indicate that GNAT does not (or did not..old blog..s= o=20 > > who knows?). Does the RM require that an implementation pass the full= =20 > > amount of memory needed to Allocate when new is called?=20 > > > The RM says that an allocator allocates storage from the storage pool.=20 > You could argue that it does not say "allocates all needed storage...",= =20 > but that would be a bit far fetched.=20 I agree, but the blog made reconsider how far fetched it was. >=20 > Anyway, a blog is not the proper place to get information from for that= =20 > kind of issue. Look at the Gnat documentation. > --=20 I'll take a look at the GNAT docs to see (and of course that blog is old, so GNAT may not do this anymore anyways), but I mainly asking in the frame of what Ada allows and/or expects. I'd like to be able to allocate storage simply without worrying how the compiler does it under the hood and just assume that any calls to Allocate will ask for the full amount of memory. =20 Am I correct to assume that Ada doesn't provide any language means to restrict what types a pool can make objects of. The times that I have wanted to make a pool are generally for specific types and it is often=20 simpler to design them if I can assume only those types are being generated Thanks for the response. I'm sorry for all the questions. That's how I=20 learn and I realize it isn't a popular way to learn in the community, but I have always learned very differently than most.