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: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: A simple question about the "new" allocator Date: Wed, 13 Aug 2014 09:36:43 +0200 Organization: cbb software GmbH Message-ID: <2g7jja99fq2x$.5crvfujapxfi$.dlg@40tude.net> References: <4dba71e0-30c9-4e16-9edb-4e8b43acc2ab@googlegroups.com> <5c104779-8f67-44f2-96be-5ad2f627df2c@googlegroups.com> <15e09ab5-804e-4070-9ad2-46dc18d17505@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: yj8+JIQUMOEawvIM7K49kA.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: number.nntp.dca.giganews.com comp.lang.ada:188409 Date: 2014-08-13T09:36:43+02:00 List-Id: On Tue, 12 Aug 2014 16:41:10 -0700 (PDT), Adam Beneschan wrote: > Not necessarily. Nothing says Pool has to have the memory used for > allocation as part of the object. The Initialize routine could allocate a > byte array on the normal heap. If this byte array isn't deallocated by > My_Storage_Pool's Finalize routine, then the storage won't be reclaimed. > > This isn't really relevant to the real world, since hopefully nobody would > write My_Storage_Pool like that. Why? "Proxy pools" are quite useful. Consider an implementation of doubly-linked list. The pointer to an element goes to the proxy pool. Upon allocation the pool gets memory from the heap. It allocates more memory than needed to keep the element adding space for the list's forward and backward links. The advantage of this approach is that the element can be of any type used as-is, links are totally invisible, no extra redirection needed, pointer to the element is plain direct access type. Simple components has such an implementation: http://www.dmitry-kazakov.de/ada/components.htm#Generic_Doubly_Linked_Web -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de