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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!newsfeed.datemas.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 12 Nov 2013 20:30:41 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Increasing GNAT's heap References: <1o29hesl8k6yk$.1kqputng2vdks$.dlg@40tude.net> <52822c73$0$6561$9b4e6d93@newsspool4.arcor-online.net> In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <528281b8$0$9523$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 12 Nov 2013 20:30:00 CET NNTP-Posting-Host: 62200bb1.newsspool1.arcor-online.net X-Trace: DXC=J3>=85fVG:6d8Nb@@ZG@b=ic==]BZ:af>4Fo<]lROoR1nkgeX?EC@@0L]_QDT8B6i?nc\616M64>:Lh>_cHTX3j=EiOf@K\RQl7 X-Complaints-To: usenet-abuse@arcor.de Xref: news.eternal-september.org comp.lang.ada:17635 Date: 2013-11-12T20:30:00+01:00 List-Id: On 12.11.13 15:00, Dmitry A. Kazakov wrote: > On Tue, 12 Nov 2013 14:26:42 +0100, Georg Bauhaus wrote: > >> On 12.11.13 12:09, Dmitry A. Kazakov wrote: >>> Does anybody know a way to increase the heap size available for GNAT? It >>> crashes with famous GNAT BUG DETECTED, Storage_Error heap exhausted. >> >> Do ulimit values have any effect? > > $ ulimit > unlimited FWIW, I am finding it difficult to trigger something beyond "Storage_Error heap exhausted" (no bug, i.e.); SE seems kind of expected for some amounts of memory requested. The program below tries to make the memory manager commit, by forcing random inits of the memory at random positions. The program runs quite a while before either me interrupting it at 2**34 storage elements (Mac OS X 10.7.5), or some Linux VMs duly reporting STORAGE_ERROR while processing the memory for 2**32. Both systems are 64 bit, though, so I can't tell what 32 bit gives as results. I'm curious. Does this trigger a bug box in your system? (size_t and others are there for hysteric raisins of comparison.) with System.Storage_Elements; use System.Storage_Elements; with Ada.Unchecked_Deallocation; with Ada.Numerics.Discrete_Random, Ada.Numerics.Elementary_Functions; with Ada.Text_IO; procedure Alloc_Ada is -- powers of 2, for growing allocated sizes: Small : constant := 16; Large : constant := 40; type Void_Ptr is access Storage_Array; subtype size_t is Storage_Offset; package Size_T_IO is new Ada.Text_IO.Integer_IO (size_t); use Size_T_IO, Ada.Text_IO; procedure Init (Object : Void_Ptr; Acc : out Storage_Element); -- Initialize some of Object with random data. Place something -- almost anywhere in the allocated area, assuming that doing so -- will require commits. procedure Free is new Ada.Unchecked_Deallocation (Storage_Array, Void_Ptr); procedure Init (Object : Void_Ptr; Acc : out Storage_Element) is subtype Places is Storage_Offset range 0 .. Object'Length - 1; package Arb is new Ada.Numerics.Discrete_Random (Storage_Element); package Pos is new Ada.Numerics.Discrete_Random (Places); package Math renames Ada.Numerics.Elementary_Functions; G : Arb.Generator; P : Pos.Generator; Offset, Previous_Offset : Storage_Offset := 0; No_Of_Inits : constant Natural := 2**(Natural (Math.Log (Float (Object'Length), 2.0)) - (Small - 4)); begin Arb.Reset (G); Pos.Reset (P); Acc := 0; for Run in 1 .. No_Of_Inits loop Previous_Offset := Offset; Offset := Pos.Random (P); Object (Offset) := Arb.Random (G); Acc := Acc / 2 + (Object (Previous_Offset) + Object (Offset)) / 4; end loop; end Init; Buffer : Void_Ptr; Kept : Storage_Element; begin for Power in size_t range Small .. Large loop Put ("At "); Put (Power); Put (" ("); Put (2**Natural (Power)); Put (")"); Buffer := new Storage_Array (0 .. 2**Natural (Power)); Init (Buffer, Acc => Kept); Put_Line (Storage_Element'Image (Kept)); Free (Buffer); end loop; end Alloc_Ada;