From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7b69a8818c20ab9f X-Google-Attributes: gid103376,public From: Florian Weimer Subject: Re: Y21C Bug Date: 2000/01/07 Message-ID: <87iu16yxv4.fsf@deneb.cygnus.argh.org>#1/1 X-Deja-AN: 569492061 References: <84nqbo$q28$1@nnrp1.deja.com> <84o0g2$u8v$1@nnrp1.deja.com> <84pvrs$7q1@ftp.kvaerner.com> <84sltt$7s3@ftp.kvaerner.com> <84t966$be0$1@nnrp1.deja.com> <84vev2$7p4@ftp.kvaerner.com> <38737352.B282CC2@easystreet.com> <851j2q$78q1@ftp.kvaerner.com> <852dt0$vdl$1@nnrp1.deja.com> Mail-Copies-To: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@cygnus.argh.org X-Trace: deneb.cygnus.argh.org 947241231 7677 192.168.1.2 (7 Jan 2000 10:33:51 GMT) Organization: Penguin on board User-Agent: Gnus/5.0804 (Gnus v5.8.4) Emacs/20.4 Mime-Version: 1.0 Reply-To: Florian Weimer NNTP-Posting-Date: 7 Jan 2000 10:33:51 GMT Newsgroups: comp.lang.ada Date: 2000-01-07T10:33:51+00:00 List-Id: Robert A Duff writes: > Robert Dewar 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. ;)