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,WEIRD_PORT 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!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!aioe.org!not-for-mail From: Dennis Hoppe Newsgroups: comp.lang.ada Subject: Re: Size of Vector limited to 1024 MB of Heap Size Date: Wed, 25 Jun 2008 17:13:12 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <6ccu94F3et2evU1@mid.individual.net> NNTP-Posting-Host: eMUkqM2Bbz1SM9HvZvzmzA.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org In-Reply-To: User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) Xref: g2news1.google.com comp.lang.ada:872 Date: 2008-06-25T17:13:12+02:00 List-Id: Hi Peter, unfortunately, your code provided below produces the same behaviour: heap(9830) malloc: *** mmap(size=2147487744) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug raised STORAGE_ERROR : heap exhausted Another point is, that I run actually a 64 bit OS (Mac OS X 10.5), so I tried to compile the source code explicitly with the 64 bit flag gcc -gnato -m64 -c heap.adb, but I got the following errors: heap.adb:10:04: instantiation error at a-convec.ads:330 heap.adb:10:04: alignment for "Vectort31b" must be at least 8 heap.adb:10:04: instantiation error at a-convec.ads:330 heap.adb:10:04: alignment for "Vectorb36b" must be at least 8 Line 10 is: package Generic_Vector is new Ada.Containers.Vectors (Element_Type => Integer, Index_Type => Natural); Is it possible, that this flag (-m64) is actually not supported for my system/compiler? gcc (GCC) 4.4.0 20080314 (experimental) [trunk revision 133226] GNAT 4.4.0 20080314 (experimental) [trunk revision 133226] Darwin Kernel 9.3.0 root:xnu-1228.5.18~1/RELEASE_I386 i386 Thank you all, Dennis Peter Schildmann wrote: > Dennis Hoppe schrieb: >> loop >> Generic_Vector.Append (Evil_Vector, Integer'Last); >> end loop; > > It's not a good idea to use the STORAGE_ERROR exception > to terminate an endless loop. > > This should work: > > with Ada.Text_IO; > with Ada.Containers; > with Ada.Containers.Vectors; > > procedure Heap is > > package Cnt_IO is new Ada.Text_IO.Integer_IO > (Ada.Containers.Count_Type); > > package Generic_Vector is new Ada.Containers.Vectors > (Element_Type => Integer, Index_Type => Natural); > > Evil_Vector : Generic_Vector.Vector; > > Size : constant := Integer'Size / Standard'Storage_Unit; > > begin > > for N in 0 .. Natural'Last / Size loop > Generic_Vector.Append (Evil_Vector, N); > end loop; > > Cnt_IO.Put (Generic_Vector.Capacity (Evil_Vector)); > > end Heap; > > > - Peter