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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ab4f67f984ef04f9 X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!transit.news.xs4all.nl!195.241.76.212.MISMATCH!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Is the Ada run-time required to detect out-of-memory conditions? References: <878yfmiuak.fsf@insalien.org> <2h7b84Fa2aefU1@uni-berlin.de> From: Ludovic Brenta Date: Sat, 22 May 2004 00:04:40 +0200 Message-ID: <87n041l9mv.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:+UJw9v1u2vzVG7eyCeedJiLNW+o= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 22 May 2004 00:03:34 CEST NNTP-Posting-Host: 83.134.238.201 X-Trace: 1085177014 dreader2.news.tiscali.nl 41754 83.134.238.201:34822 X-Complaints-To: abuse@tiscali.nl Xref: controlnews3.google.com comp.lang.ada:757 Date: 2004-05-22T00:03:34+02:00 List-Id: > Hi, > > I'm the original reporter of the bug. I forgot to mention that I > limited the virtual memory of the process using 'ulimit -v 100000' > in a bash. > > I'm very new to Ada, but I'm impressed of all the features. In > parallel I'm developing a little library to make C programming > easier. In this library I malloc'ed some "emergency memory" at the > program start which is simply freed when the process gets out of > memory. Then the error handler can at least raise an exception or > print some warning. > > Perhaps the GNAT runtime library could use a similar approach. I just closed your bug report after determining that the issue was not in libgnat but in the kernel. Basically, Linux sends SIGKILL to programs that exhaust physical RAM; as you know, SIGKILL cannot be caught so libgnat has no chance to raise an exception. If the virtual memory is exhausted before physical memory is, then libgnat does raise Storage_Error. I am quite confident that you can implement your "emergency memory" scheme in Ada, but this will not do anything to prevent SIGKILL. At best, you can recover from a SIGSEGV. This is true also of your C library. BTW, why not view the Ada compiler and library as "a library to make C programming easier"? :) -- Ludovic Brenta.