|
From: anon on 24 Jun 2008 19:36 0 - 1023MB 16-bit works -- 2GB but in Ada: Integers are 4 bytes 0 - 1023MB 32-bit words -- 4GB So: 1024MB 16-bit elements would be (2GB+1 (16-bit words)) but 1024MB 32-bit elements aka 1024MB Integer would be (4GB+1 (32-bit words)) -- STORAGE_ERROR so it seam that you did get the full 4GB RAM memory. But the statement Generic_Vector.Append (Evil_Vector, Integer'Last); will create a vector size of 4GB with each element being 4 bytes giving a total size of 16GB. So, use: Generic_Vector.Append ( Evil_Vector, ( Natural'Last / 4 ) ) ; or better yet Generic_Vector.Append ( Evil_Vector, ( Natural'Last / Natural'Size ) ) ; to give you a 1GB Vector size with an 4 byte element size that uses a total size of 4GB. In <iVe8k.138597$SV4.76767(a)bgtnsc04-news.ops.worldnet.att.net>, anon(a)anon.org (anon) writes: >Adjust your heap size in the linking phase. > >In <g3qc68$5a5$1(a)aioe.org>, Dennis Hoppe <dennis.hoppe(a)hoppinet.de> writes: >>Hi, >> >>my machine has 4 GB of RAM and I am wondering, why I can't use >>at least 2 or 3 GBytes to run an Ada program. It seems, that my >>Ada Compiler (Gnat 4.4.0) limit the memory to 2 GB per default. >>Is it possible to allocate more than 2 GB? >> >>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. >> >> >>with Ada.Containers.Vectors; >> >>procedure Heap is >> package Generic_Vector is new Ada.Containers.Vectors >> (Element_Type => Integer, Index_Type => Natural); >> >> Evil_Vector : Generic_Vector.Vector; >>begin -- Heap >> loop >> Generic_Vector.Append (Evil_Vector, Integer'Last); >> end loop; >>end Heap; >> >> >>heap(6374) 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 >> >> >>I could not find a suitable Compiler switch or a parameter, that >>can be set for the operating system (linux). "ulimit -v" is already >>set to unlimited. >> >>"gnatmem" reports, that my water mark with 1024 MB is reached, but >>the final water mark is, needless to say, higher. >> >> >>Best regards, >> Dennis Hoppe >
From: tmoran on 24 Jun 2008 20:11 > but in Ada: Integers are 4 bytes The Ada 95 Reference Manual 3.5.4(21) says "In an implementation, the range of Integer shall include the range -2**15+1 .. +2**15-1." Has this changed in Ada 2005?
From: anon on 24 Jun 2008 22:49 RM for Ada 95 and Ada 2005 -- 3.5.4 ( 21 ) : says that an Integer must include the range -2**15+1 .. +2**15-1 aka -32768 .. +32767 but it is not limited to that range. Check RM 3.5.4 ( 26 ). The norm for PC's Integer is -2**32+1 .. +2**32-1 To verify what the true range is on your Ada system look at the Standard package. For GNAT it is build into the compiler so type "gnat standard >standard.ads" Then look at file "standard.ads" you will see lines: package Standard is pragma Pure(Standard); type Boolean is (False, True); type Integer is range -(2 ** 31) .. +(2 ** 31 - 1); subtype Natural is Integer range 0 .. +(2 ** 31 - 1); ... end Standard; Or try this program -- -- i.adb -- with Ada.Text_IO ; use Ada.Text_IO ; with Ada.Integer_Text_IO ; use Ada.Integer_Text_IO ; procedure i is begin put ( Integer'Last ) ; new_line ; end ; In <FJSdndpDzI7XEPzVnZ2dnUVZ_rfinZ2d(a)comcast.com>, tmoran(a)acm.org writes: >> but in Ada: Integers are 4 bytes >The Ada 95 Reference Manual 3.5.4(21) says >"In an implementation, the range of Integer shall include the range >-2**15+1 .. +2**15-1." > Has this changed in Ada 2005?
From: christoph.grein on 25 Jun 2008 04:04 On 25 Jun., 04:49, a...(a)anon.org (anon) wrote: > RM for Ada 95 and Ada 2005 -- 3.5.4 ( 21 ) : says that an Integer must > include the range > > -2**15+1 .. +2**15-1 aka -32768 .. +32767 > > but it is not limited to that range. Check RM 3.5.4 ( 26 ). Paragraph (26) has nothing to do with Integer - it's about nonstandard integer types, and Integer is a standard integer type. > The norm for PC's Integer is -2**32+1 .. +2**32-1 You surely mean -(2**31) .. (2**31) - 1 "Norm"? You mean it's generally the case... There is no (DIN, EU, ...) norm, or is there.
|
Pages: 1 Prev: ridiculous question Next: Interfacing to C and long long data type |