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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aa67891ee705f5f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-21 07:27:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Q: Creating my own storage pools Date: 21 Jan 2003 10:10:28 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3e2cc50a$0$33931$bed64819@news.gradwell.net> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1043162571 16768 128.183.235.92 (21 Jan 2003 15:22:51 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 21 Jan 2003 15:22:51 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:33298 Date: 2003-01-21T15:22:51+00:00 List-Id: porton@ex-code.com (Victor Porton) writes: > 13.11.20. "The effect of calling Allocate and Deallocate for a standard > storage pool directly (rather than implicitly via an allocator or an > instance of Unchecked_Deallocation) is unspecified." > > I want to use the standard storage pool for allocating memory for my > own portable storage pool. But how to allocate from the standard pool > the given number of storage elements? My_Storage := new System.Storage_Elements.Storage_Array (size); > Should I use packed arrays? Probably not. You want the storage pool to be efficient in time; forcing the compiler to pack an array that is not "naturally" packed makes it inefficient in time. However, on any reasonable system, System.Storage_Elements.Storage_Array is "naturally" packed. > Also how to deal with alignment of the allocated memory? Make sure the pointer you return is aligned as required. This means you will have small spaces of unused storage in your pool -- -- Stephe