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,427e29f23a651ddb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!multikabel.net!feed20.multikabel.net!amsnews11.chello.com!newsfeed01.chello.at!newsfeed02.chello.at!news.hispeed.ch.POSTED!not-for-mail Message-Id: <55996242.eObHiMcIUq@linux1.krischik.com> From: Martin Krischik Subject: Re: Finding out minimal allocation unit Newsgroups: comp.lang.ada Date: Thu, 05 Apr 2007 09:35:57 +0200 References: <20070403144350.6c95e085@cube.tz.axivion.com> <1175606570.4684.11.camel@localhost> <461257ea$1@news.post.ch> <4ecea2f308sbellon@sbellon.de> User-Agent: KNode/0.10.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@hispeed.ch Organization: hispeed.ch NNTP-Posting-Host: 84.73.230.248 (84.73.230.248) NNTP-Posting-Date: Thu, 05 Apr 2007 09:45:02 +0200 X-Trace: 352244614a8fef1ec435d08641 Xref: g2news1.google.com comp.lang.ada:14792 Date: 2007-04-05T09:35:57+02:00 List-Id: Stefan Bellon wrote: >> Write your own storage pool that has the behavior you need. It's >> relatively easy to do, especially if you have fixed size elements. >> And then you can effectively use an array to allocate elements and >> still have cheap insertion and deletion and reordering. > > I'm a bit unclear about how to do it. Do I implement the Allocate using > the standard storage pool (i.e. using 'new') or do I interface it > directly to the underlying C library (i.e. using 'malloc')? In both > cases I still have the same problem as above. First we need to know which platform you are using (compiler/OS). Then: how a storrage pool get's it memory is up to the pool designer. In your case you could allocate a large chuck of memory strait from the OS and then sub-allocate it using an algorithm optimised for your needs. You spoke of storing data inside an array - which suggest all elements have the same size. Then you optimised storrage pool won't need keep track of the allocation size - something a universal pool needs to do. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com