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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f479f3331eef5353 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Schildmann Newsgroups: comp.lang.ada Subject: Re: Size of Vector limited to 1024 MB of Heap Size Date: Wed, 25 Jun 2008 12:39:40 +0200 Message-ID: <6celjdF3gdt8gU1@mid.individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net 6nZkKT83+HlChtrst1+m7gHFN7BIKwSi+4EQaRjEH9sh9vrBzD Cancel-Lock: sha1:BHKtjQJYv9S86wVTCv96PzWaJWM= User-Agent: IceDove 1.5.0.14eol (X11/20080509) In-Reply-To: Xref: g2news1.google.com comp.lang.ada:868 Date: 2008-06-25T12:39:40+02:00 List-Id: Dennis Hoppe schrieb: > Here is a simple example of an "evil" vector, that gains > more memory in each pass. The program terminates exactly at > 1024 MB of used Heap memory. I was able to allocate much more memory with the following test program on a 64-bit machine running Debian Etch (tested with gcc 4.1.2 and gcc 4.3.1). - Peter with Ada.Text_IO; with Ada.Containers; with Ada.Containers.Vectors; procedure Heap is subtype Element_Type is Long_Integer; -- 8 bytes Element_Size : constant := Element_Type'Size / Standard'Storage_Unit; subtype Index_Type is Natural range 0 .. 6 * 1024 * 1024 * 1024 / Element_Size - 1; -- 6GB! package Cnt_IO is new Ada.Text_IO.Integer_IO (Ada.Containers.Count_Type); package Generic_Vector is new Ada.Containers.Vectors (Element_Type => Element_Type, Index_Type => Index_Type); Evil_Vector : Generic_Vector.Vector; begin for N in Index_Type'Range loop Generic_Vector.Append (Evil_Vector, Long_Integer (N)); end loop; Ada.Text_IO.Put ("Length: "); Cnt_IO.Put (Generic_Vector.Length (Evil_Vector)); Ada.Text_IO.New_Line; Ada.Text_IO.Put ("Capacity: "); Cnt_IO.Put (Generic_Vector.Capacity (Evil_Vector)); end Heap;