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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews.google.com!k39g2000hsf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada containers and custom allocators Date: Mon, 7 Jan 2008 23:59:34 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <472f2c87-1238-42a5-8b94-92e9b70981da@f47g2000hsd.googlegroups.com> NNTP-Posting-Host: 137.138.37.241 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1199779174 1904 127.0.0.1 (8 Jan 2008 07:59:34 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Jan 2008 07:59:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k39g2000hsf.googlegroups.com; posting-host=137.138.37.241; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20071127 Red Hat/1.5.0.12-0.8.el4 Firefox/1.5.0.12 pango-text,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19268 Date: 2008-01-07T23:59:34-08:00 List-Id: 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. > 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. [...] > (or, the > storage pool passed would have to be completely general, allowing any size > allocation, which would eliminate the vast majority of interesting things > that you can do with storage pools). There are ways to overcome this problem, at least for some container types. Node-based containers could use fixed-size allocators, but of course it is the container which would then instantiate the allocator with the proper node size. It was possible in C++. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com