comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Hoppe <dennis.hoppe@hoppinet.de>
Subject: Re: Size of Vector limited to 1024 MB of Heap Size
Date: Wed, 25 Jun 2008 17:13:12 +0200
Date: 2008-06-25T17:13:12+02:00	[thread overview]
Message-ID: <g3tna8$f9c$1@aioe.org> (raw)
In-Reply-To: 

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



  reply	other threads:[~2008-06-25 15:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24  8:44 Size of Vector limited to 1024 MB of Heap Size Dennis Hoppe
2008-06-24 15:03 ` Adam Beneschan
2008-06-24 17:32 ` Robert A Duff
2008-06-24 18:55 ` Peter Schildmann
2008-06-25 15:13   ` Dennis Hoppe [this message]
2008-06-25 17:26     ` (see below)
2008-06-25 21:09       ` Dennis Hoppe
2008-06-24 20:03 ` Gene
2008-06-24 20:38   ` Robert A Duff
2008-06-24 22:53 ` anon
2008-06-24 23:36   ` Extra footnote: " anon
2008-06-25  0:11     ` tmoran
2008-06-25  2:49       ` anon
2008-06-25  8:04         ` christoph.grein
2008-06-25 10:39 ` Peter Schildmann
2008-06-25 15:29   ` Dennis Hoppe
replies disabled

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