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=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Custom Storage Pool questions Date: Mon, 13 Sep 2021 13:12:39 +0200 Organization: Adalog Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 13 Sep 2021 11:12:41 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="05fe24b4bffd1349bcdf3a02a20b4a95"; logging-data="5678"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/95Y3XKzi6N2AziM98f1wK" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cancel-Lock: sha1:w1ksWcD4DfM/HSj14B/0toCFXt8= In-Reply-To: Content-Language: fr Xref: reader02.eternal-september.org comp.lang.ada:62720 List-Id: Le 13/09/2021 à 02:53, Jere a écrit : > I was learning about making user defined storage pools when > I came across an article that made me pause and wonder how > portable storage pools actually can be. In particular, I assumed > that the Size_In_Storage_Elements parameter in the Allocate > operation actually indicated the total number of storage elements > needed. > > procedure Allocate( > Pool : in out Root_Storage_Pool; > Storage_Address : out Address; > Size_In_Storage_Elements : in Storage_Elements.Storage_Count; > Alignment : in Storage_Elements.Storage_Count) is abstract; > > But after reading the following AdaCore article, my assumption is now > called into question: > https://blog.adacore.com/header-storage-pools > > In particular, the blog there advocates for separately counting for > things like unconstrained array First/Last indices or the Prev/Next > pointers used for Controlled objects. Normally I would have assumed > that the Size_In_Storage_Elements parameter in Allocate would account > for that, but the blog clearly shows that it doesn't [...] That blog shows a special use for Storage_Pools, where you allocate /user/ data on top of the requested memory. When called by the compiler, it is up to the compiler to compute how much memory is needed, and your duty is to just allocate that. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52 https://www.adalog.fr