comp.lang.ada
 help / color / mirror / Atom feed
* Re: Allocating memory--Ada95
  1998-05-19  0:00 Allocating memory--Ada95 jsanchor
  1998-05-19  0:00 ` Markus Kuhn
@ 1998-05-19  0:00 ` Matthew Heaney
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Heaney @ 1998-05-19  0:00 UTC (permalink / raw)



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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Allocating memory--Ada95
@ 1998-05-19  0:00 jsanchor
  1998-05-19  0:00 ` Markus Kuhn
  1998-05-19  0:00 ` Matthew Heaney
  0 siblings, 2 replies; 3+ messages in thread
From: jsanchor @ 1998-05-19  0:00 UTC (permalink / raw)



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.



Regards,
Jay.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Allocating memory--Ada95
  1998-05-19  0:00 Allocating memory--Ada95 jsanchor
@ 1998-05-19  0:00 ` Markus Kuhn
  1998-05-19  0:00 ` Matthew Heaney
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Kuhn @ 1998-05-19  0:00 UTC (permalink / raw)



jsanchor@my-dejanews.com wrote:
> 
> I am trying to dynamically allocate storage(using 'new' allocator)...but I
> need to allocate within certain bounds. Does anybody know how.

Read section 13.11 of the ARM to learn how to declare your own storage
pool manager for certain access types.

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-05-19  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-19  0:00 Allocating memory--Ada95 jsanchor
1998-05-19  0:00 ` Markus Kuhn
1998-05-19  0:00 ` Matthew Heaney

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