comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <usenet@deneb.cygnus.argh.org>
Subject: Re: Y21C Bug
Date: 2000/01/07
Date: 2000-01-07T10:33:51+00:00	[thread overview]
Message-ID: <87iu16yxv4.fsf@deneb.cygnus.argh.org> (raw)
In-Reply-To: wcc66x7w220.fsf@world.std.com

Robert A Duff <bobduff@world.std.com> writes:

> Robert Dewar <robert_dewar@my-deja.com> writes:
> 
> > 1. The ability to declare very large areas of memory with
> > commit-on-use semantics. There are many uses of this. I have
> > the feeling that a lot of programmers still don't understand
> > commit-on-use.
> 
> Commit on use is indeed very cool.
> 
> Do you know which operating systems support it?

I think commit on use is the same thing what's called copy on write
on Linux.  For example, you can run the following program on a box
which only has some 300 MB of virtual memory (RAM + swap), and it will
`allocate' approximately 1.5 GB of `memory':

with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Alloc_Mem is
   type Long_String is new String (1 .. 1024 * 1024);
   type Long_String_Access is access Long_String;
   LSA : array (1 .. 1500) of Long_String_Access;
   Byte_Count : Natural := 0;
begin
   for I in LSA'Range loop
      LSA (I) := new Long_String;
      Byte_Count := Byte_Count + Long_String'Size / 8;
   end loop;
   Put ("Successfully allocated ");
   Put (Byte_Count, 0);
   Put_Line (" bytes.");
exception
   when Storage_Error =>
      Put ("Allocation failure after ");
      Put (Byte_Count, 0);
      Put_Line (" bytes.");
end Alloc_Mem;

Of course, you shouldn't use an initialized allocator here. ;)




  parent reply	other threads:[~2000-01-07  0:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-02  0:00 Y21C Bug reason67
2000-01-02  0:00 ` Robert Dewar
2000-01-03  0:00   ` Tarjei T. Jensen
2000-01-03  0:00     ` Jeff Creem
2000-01-03  0:00       ` Tarjei T. Jensen
2000-01-03  0:00     ` Robert A Duff
2000-01-04  0:00       ` Tarjei T. Jensen
2000-01-04  0:00         ` Samuel Tardieu
2000-01-04  0:00         ` Robert A Duff
2000-01-04  0:00         ` Robert Dewar
2000-01-05  0:00           ` Tarjei T. Jensen
2000-01-05  0:00             ` Al Christians
2000-01-06  0:00               ` Tarjei T. Jensen
2000-01-06  0:00                 ` Robert Dewar
2000-01-06  0:00                   ` Robert A Duff
2000-01-06  0:00                     ` Larry Kilgallen
2000-01-07  0:00                     ` Florian Weimer [this message]
2000-01-07  0:00                       ` Robert A Duff
2000-01-07  0:00                         ` Robert Dewar
2000-02-04  0:00                           ` Florian Weimer
2000-02-04  0:00                             ` Robert A Duff
2000-02-04  0:00                               ` Florian Weimer
2000-01-11  0:00                         ` Mats Weber
2000-01-11  0:00                           ` Robert A Duff
2000-01-12  0:00                             ` Mats Weber
2000-01-12  0:00                               ` Thierry Lelegard
2000-01-13  0:00                                 ` Mats Weber
2000-01-13  0:00                                 ` Robert A Duff
2000-01-13  0:00                                   ` Larry Kilgallen
2000-01-13  0:00                                   ` Thierry Lelegard
     [not found]                               ` <387dfb1e.cbbf14c7@mail.com>
2000-01-13  0:00                                 ` Larry Kilgallen
2000-01-11  0:00                     ` Mats Weber
2000-01-07  0:00                   ` Tarjei T. Jensen
2000-01-07  0:00                     ` Robert Dewar
2000-01-06  0:00               ` Robert Dewar
2000-01-05  0:00             ` Robert Dewar
2000-01-06  0:00               ` Georg Bauhaus
2000-01-06  0:00                 ` Tarjei T. Jensen
2000-01-06  0:00               ` Richard D Riehle
2000-01-06  0:00               ` Tarjei T. Jensen
2000-01-06  0:00                 ` Larry Kilgallen
2000-01-04  0:00       ` Robert Dewar
2000-01-04  0:00         ` Charles Hixson
2000-01-04  0:00           ` Keith Thompson
2000-01-05  0:00           ` Robert Dewar
2000-01-05  0:00           ` Robert Dewar
2000-01-05  0:00             ` Y21C Bug :-) Charles Hixson
2000-01-06  0:00               ` Ted Dennison
2000-01-07  0:00                 ` Keith Thompson
2000-01-07  0:00                   ` 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