comp.lang.ada
 help / color / mirror / Atom feed
* Re: Memory allocation
  2000-03-01  0:00 Memory allocation Andreas
@ 2000-03-01  0:00 ` ada_95
  2000-03-02  0:00 ` ada_95
  2000-03-02  0:00 ` Oliver Kellogg
  2 siblings, 0 replies; 6+ messages in thread
From: ada_95 @ 2000-03-01  0:00 UTC (permalink / raw)


In article <38BCD2B8.503B95FA@gmx.net>,
  Andreas <Amun_Ra72@gmx.net> wrote:
> Hi!
>
> How can I find out in Ada95 with GNAT how much
memory a program may
> allocate (i.e. how much memory is currently
free)?
> Does anyone have an idea?
> (It's not System.Memory_Size, that's for sure
:-))
>
> Could you please send replies via e-mail, too.
>
> Thanks in advance
>
> Andreas
> Amun_Ra72@gmx.net
>
>
It is very easy to find how much memory needed
(allocate/deallocate) for a particular access
object. This holds true for any compiler. Here is
an example.

   declare
      type Integer_Access is access Integer;
      Int_Acc : Integer_Access;
   begin
      Int_Acc := new Integer' (911);
      Put_Line ("Size is: " &
        Integer'Image (Int_Acc.all'Size));
      -- ...
   end;



Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Memory allocation
@ 2000-03-01  0:00 Andreas
  2000-03-01  0:00 ` ada_95
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andreas @ 2000-03-01  0:00 UTC (permalink / raw)


Hi!

How can I find out in Ada95 with GNAT how much memory a program may
allocate (i.e. how much memory is currently free)?
Does anyone have an idea?
(It's not System.Memory_Size, that's for sure :-))

Could you please send replies via e-mail, too.

Thanks in advance

Andreas
Amun_Ra72@gmx.net





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

* Re: Memory allocation
  2000-03-01  0:00 Memory allocation Andreas
  2000-03-01  0:00 ` ada_95
  2000-03-02  0:00 ` ada_95
@ 2000-03-02  0:00 ` Oliver Kellogg
  2000-03-05  0:00   ` Nick Roberts
  2 siblings, 1 reply; 6+ messages in thread
From: Oliver Kellogg @ 2000-03-02  0:00 UTC (permalink / raw)


In article <38BCD2B8.503B95FA@gmx.net>,
  Andreas <Amun_Ra72@gmx.net> wrote:
>
> How can I find out in Ada95 with GNAT how much memory a program may
> allocate (i.e. how much memory is currently free)?

There is no standard way. If you are running Unix then
see the getrlimit() manpage.

-- Oliver
-- okellogg at freenet dot de


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Memory allocation
  2000-03-01  0:00 Memory allocation Andreas
  2000-03-01  0:00 ` ada_95
@ 2000-03-02  0:00 ` ada_95
  2000-03-02  0:00 ` Oliver Kellogg
  2 siblings, 0 replies; 6+ messages in thread
From: ada_95 @ 2000-03-02  0:00 UTC (permalink / raw)


In article <38BCD2B8.503B95FA@gmx.net>,
  Andreas <Amun_Ra72@gmx.net> wrote:
> Hi!
>
> How can I find out in Ada95 with GNAT how much memory a program may
> allocate (i.e. how much memory is currently free)?
> Does anyone have an idea?
> (It's not System.Memory_Size, that's for sure :-))
>
> Could you please send replies via e-mail, too.
>
> Thanks in advance
>
> Andreas
> Amun_Ra72@gmx.net
>
>
It is very easy. Just append .all'Size to your pointer object, the
memory size in bits will be returned. By the way, it is not specific
not GNAT or any other compilers. It is compiler independence.


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Memory allocation
  2000-03-02  0:00 ` Oliver Kellogg
@ 2000-03-05  0:00   ` Nick Roberts
  2000-03-06  0:00     ` Larry Kilgallen
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2000-03-05  0:00 UTC (permalink / raw)


Some may find it interesting to note that a (truly) secure operating system
cannot generally provide this specific functionality (how much free memory
is left), in order to avoid a thing called a 'covert channel'.

What it can, and should, provide, however, is a way for a program to say
'reserve x amount of memory exclusively for me'. This needs to be
accompanied by a way to say 'now unreserve it'. Can anybody tell me of an
actual OS that does just this, please?

--
Nick Roberts
http://www.adapower.com/lab/adaos








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

* Re: Memory allocation
  2000-03-05  0:00   ` Nick Roberts
@ 2000-03-06  0:00     ` Larry Kilgallen
  0 siblings, 0 replies; 6+ messages in thread
From: Larry Kilgallen @ 2000-03-06  0:00 UTC (permalink / raw)


In article <38c30e0f@eeyore.callnetuk.com>, "Nick Roberts" <nickroberts@callnetuk.com> writes:
> Some may find it interesting to note that a (truly) secure operating system
> cannot generally provide this specific functionality (how much free memory
> is left), in order to avoid a thing called a 'covert channel'.

Only if the memory pool being measured is shared between security
compartments.  In virtual memory operating systems it is fairly
common to allow individual processes to have access to excessive
amounts of "memory" that isn't really there.  Obviously timing
channels are possible through the behaviour of the paging system
if it was not designed to isolate compartments from each other
in this regard.

> What it can, and should, provide, however, is a way for a program to say
> 'reserve x amount of memory exclusively for me'. This needs to be
> accompanied by a way to say 'now unreserve it'. Can anybody tell me of an
> actual OS that does just this, please?

VMS lets you lock pages into memory with system service $LCKPAG
and release them with $ULKPAG.  That persists despite swapping
activity, which I suppose is what you mean by "exclusively for
me".  A lighter-weight call to $LKWSET will ensure that a page
is in physical memory whenever your process is swapped in.

Larry Kilgallen




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

end of thread, other threads:[~2000-03-06  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-01  0:00 Memory allocation Andreas
2000-03-01  0:00 ` ada_95
2000-03-02  0:00 ` ada_95
2000-03-02  0:00 ` Oliver Kellogg
2000-03-05  0:00   ` Nick Roberts
2000-03-06  0:00     ` Larry Kilgallen

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