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!news4.google.com!postnews.google.com!z17g2000hsg.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada containers and custom allocators Date: Fri, 11 Jan 2008 13:02:24 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <472f2c87-1238-42a5-8b94-92e9b70981da@f47g2000hsd.googlegroups.com> NNTP-Posting-Host: 85.3.192.199 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1200085345 31351 127.0.0.1 (11 Jan 2008 21:02:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 11 Jan 2008 21:02:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z17g2000hsg.googlegroups.com; posting-host=85.3.192.199; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19328 Date: 2008-01-11T13:02:24-08:00 List-Id: On 11 Sty, 06:00, "Randy Brukardt" wrote: > > It can work -- you just can't take advantage of (say) fixed sized > > chunks. I guess what you're saying is that that defeats the main > > purpose! > > The OP claimed that fixed-size allocators could be used, and my lengthy > reply was intended to rebut that. Surely, they can't be used portably or > generally. In Ada, you mean? In C++ this works by passing the allocator parameter to the template container class, which in turn can re-bind the allocator to use whatever size is used internally. This means that the fixed-size allocator cannot be prepared for only a given allocation size, but that does not seem to be a problem in practice. The whole point of using a fixed-size allocator is to enable some specialized allocation scheme (like bitmap-based management of free blocks) and this is independent of any given size. In other words, the allocator should be ready to work with any size, but this is fixed once by the container itself. You might say that there is a limitation in that container will have to use nodes of fixed size, but this, again does not seem to be a problem - I have never seen a list (for example) that internally uses nodes of varying sizes. This works in C++ and gives spectacular performance improvements. It's a pity Ada does not provide anything in this area. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com