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,2caa964596702891 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail Message-ID: <44DA09B7.6010607@on2.com> Date: Wed, 09 Aug 2006 12:13:43 -0400 From: Matthew Heaney Organization: On2 Technologies, Inc User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 Newsgroups: comp.lang.ada To: msimonides@power.com.pl CC: heaney@adacore.com, Matthew Heaney Subject: Re: Ada.Containers and Storage_Pools References: <1155125040.715167.132300@m73g2000cwd.googlegroups.com> In-Reply-To: <1155125040.715167.132300@m73g2000cwd.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Date: 09 Aug 2006 16:13:43 GMT NNTP-Posting-Host: 64f9f055.news.twtelecom.net X-Trace: DXC=[4]VbE?S9;gM`bkG\nAf6kC_A=>8kQj6mY;@_o827nGcfN1< msimonides@power.com.pl wrote: > I'm working on a caching DNS resolver for our project. The structures > used to hold data in cache make use of Ada.Containers packages (e.g. > each node stores a map of list resource records for each data type, so > there is a lot of individual containers). OK, it sounds like you have a map container whose elements are list containers. Is that right? > The problem I'm facing (and that is certain to show up in other parts > of our project) is that I need to limit the size of cache in memory. To > do this I would need to be able to have the containers allocate their > nodes from a user-specified storage pool with some limiting mechanism > (I already have such a pool and use it for objects that are allocated > by my code). Is the pool bounded or unbounded? In other words, can you run out of nodes? If so, what should happen? > So I have a question: is there a possibility, either in GNAT 3.4.5 or > in Ada 2005, to specify a custom storage pool for use by containers? If > not, is there any other solution to limiting the size of memory used by > containers? Our philosophy in the design of the Ada 2005 container library was to optimize around the common case. Unfortunately, your application needs a custom storage pool and hence is not common case. So no you can't specify a custom storage pool. One possibility is to keep a list around and use it as a kind of storage pool for the list objects that are map elements. You can use the Splice operation for lists to move list nodes between list objects (that are map elements) and the list object that serves as the pool. > The only solution that I have found is using some other containers > library (I've seen that Booch components allow for specifying custom > storage pools), but I'd really prefer to stick with the standard ones. I'd like to know more about what you're doing, and about the nature of your storage pool. If you don't mind drop me some email so we can discuss your issues in more detail. Thanks, Matt