comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.A.Leake@nasa.gov>
Subject: Re: Q: Creating my own storage pools
Date: 21 Jan 2003 10:10:28 -0500
Date: 2003-01-21T15:22:51+00:00	[thread overview]
Message-ID: <u4r825yjf.fsf@nasa.gov> (raw)
In-Reply-To: 3e2cc50a$0$33931$bed64819@news.gradwell.net

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



  reply	other threads:[~2003-01-21 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-21  3:56 Q: Creating my own storage pools Victor Porton
2003-01-21 15:10 ` Stephen Leake [this message]
2003-01-21 19:33 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox