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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,81633e7277ffacee X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada containers and custom allocators References: <472f2c87-1238-42a5-8b94-92e9b70981da@f47g2000hsd.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4hVgj.291534$Fc.131494@attbi_s21> NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1199841472 12.201.97.213 (Wed, 09 Jan 2008 01:17:52 GMT) NNTP-Posting-Date: Wed, 09 Jan 2008 01:17:52 GMT Organization: AT&T ASP.att.net Date: Wed, 09 Jan 2008 01:17:52 GMT Xref: g2news1.google.com comp.lang.ada:19285 Date: 2008-01-09T01:17:52+00:00 List-Id: Maciej Sobczak wrote: > On 8 Sty, 02:54, "Randy Brukardt" wrote: > >>> Is it possible to set up a custom allocator for use with any given Ada >>> container? >> If you mean an allocator for the private data of the container (which >> includes all of the elements and is the bulk of the container), the answer >> is no. > > This is exactly what I mean. It is not uncommon for a program to have > a majority of its dynamic memory managed by containers. Actually, Brukardt's reply is technically incorrect. The containers are tagged; you can derive from them and override the appropriate operations to obtain the behavior you require. Of course, this means you either have to know the internals of the container in question, or you have to override all the operations, effectively writing your own container. Which brings us to >> The standard Ada containers do not provide any mechanism to control >> how/were the container allocates memory. > > This limitation prevents programmers from doing many interesting > optimizations. Even if we put performance issues aside, I might want > to control the memory allocation for reliability. The standard library is necessarily intended for general use, not optimized for any specific requirements. If it doesn't meet your specific requirements, then you should consider custom components that do. -- Jeff Carter "Gentlemen, you can't fight in here. This is the War Room!" Dr. Strangelove 30