From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: Allocating memory--Ada95
Date: 1998/05/19
Date: 1998-05-19T00:00:00+00:00 [thread overview]
Message-ID: <matthew_heaney-ya023680001905982305450001@news.ni.net> (raw)
In-Reply-To: 6jsa9j$ous$1@nnrp1.dejanews.com
In article <6jsa9j$ous$1@nnrp1.dejanews.com>, jsanchor@my-dejanews.com wrote:
(start of quote)
I am trying to dynamically allocate storage(using 'new' allocator)...but I
need to allocate within certain bounds. Does anybody know how.
Thank you in advance.
(end of quote)
Override Root_Storage_Pool, declare an object of that type, and place
storage in memory where you require, as in
with System.Storage_Pools; use ...;
package My_Storage_Pools is
type My_Storage_Pool (Size : Positive) is
new Root_Storage_Pool with record
Elements : Storage_Element_Array (1 .. Size);
end record;
<primitive ops>
end;
with My_Storage_Pool; use ...;
package Allocation is
Pool : My_Storage_Pool (<some large size>);
for Pool'Address use <some address>;
end;
Now when you declare an access type, use your custom pool to as its storage
pool:
with Allocation;
package P is
type T is ...;
type T_Access is access T;
for T_Access'Storage_Pool use Allocation.Pool;
end;
That's the general flavor of solution.
next prev parent reply other threads:[~1998-05-19 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-19 0:00 Allocating memory--Ada95 jsanchor
1998-05-19 0:00 ` Matthew Heaney [this message]
1998-05-19 0:00 ` Markus Kuhn
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox