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,start X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed1.ip.tiscali.net!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Is the Ada run-time required to detect out-of-memory conditions? From: Ludovic Brenta Date: Fri, 21 May 2004 00:54:27 +0200 Message-ID: <878yfmiuak.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:0yf1SLGqZ3L5WYmNfIL2adIaGec= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 21 May 2004 00:53:17 CEST NNTP-Posting-Host: 83.134.237.195 X-Trace: 1085093597 dreader2.news.tiscali.nl 41764 83.134.237.195:34108 X-Complaints-To: abuse@tiscali.nl Xref: controlnews3.google.com comp.lang.ada:713 Date: 2004-05-21T00:53:17+02:00 List-Id: Hello, I have received a bug report [1] against GNAT 3.15p and reproduced the same behaviour with GCC 3.4. I would like the advice of language lawyers on the issue. [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=250076 The program allocates memory in an infinite loop using "new" and the default storage pool, and of course exhausts all available storage. The issue is whether or not Storage_Error should be raised. With GNAT, no exception is raised; instead the program receives SIGKILL (not even SIGSEGV) from Linux. My first impression is that the program exhausts physical memory (RAM + swap) before exhausting the default storage pool, the size of which is defined to be the total size of the virtual address space. As a result, the kernel detects the out-of-memory condition before the Ada run-time library does, and sends SIGKILL to the program. Of course, the program has no chance to turn SIGKILL into an exception. Is my assessment correct? Is this a bug in the GNAT library? Thanks for any insight. PS. The original reported says that the program receives SIGSEGV. He uses Linux 2.4.22. I use 2.4.26 and the program receives SIGKILL instead. I don't know if this is a known change in the kernel's behaviour. -- Ludovic Brenta.