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: Tue, 14 Sep 2021 08:08:48 +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: Tue, 14 Sep 2021 06:08:47 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="0ecb7a9213884667d432fcf8701789bd"; logging-data="1267"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+23EpNnDl0P+V4ZTWbZ9e9" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cancel-Lock: sha1:DclbkluBBWqEPQUp0TcKJzZe1I4= In-Reply-To: Content-Language: fr Xref: reader02.eternal-september.org comp.lang.ada:62729 List-Id: Le 14/09/2021 à 02:48, Jere a écrit : >>> 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. >> > Yes, but if you look at that blog, they are allocating space for the /user/ data > and for the Next/Prev for controlled types and First/Last for unconstrained > arrays in addition to the size specified by allocate. > > I agree I feel it is up to the compiler to provide the correct size to Allocate, > but the blog would indicate that GNAT does not (or did not..old blog..so > who knows?). Does the RM require that an implementation pass the full > amount of memory needed to Allocate when new is called? > The RM says that an allocator allocates storage from the storage pool. You could argue that it does not say "allocates all needed storage...", but that would be a bit far fetched. Anyway, a blog is not the proper place to get information from for that kind of issue. Look at the Gnat documentation. -- 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