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!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed.mathworks.com!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Is the Ada run-time required to detect out-of-memory conditions? Date: 22 May 2004 12:40:35 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <878yfmiuak.fsf@insalien.org> <2h7b84Fa2aefU1@uni-berlin.de> <87n041l9mv.fsf@insalien.org> <87isepl9c9.fsf@insalien.org> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1085226311 15805 62.49.19.209 (22 May 2004 11:45:11 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 22 May 2004 11:45:11 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: controlnews3.google.com comp.lang.ada:771 Date: 2004-05-22T12:40:35+01:00 List-Id: Ludovic Brenta writes: > I forgot to point you at one of Ada's neat features called > "User-Defined Storage Pools". Look at the Ada Reference Manual[1] > section 13.11. You can define your own allocation and deallocation > mechanism for any access type; your storage pool may for example > preallocate X megabytes from the operating system, allocate from that > buffer, and raise Storage_Error when it is exhausted. As long as X <= > Physical_Ram, you then have a guarantee that your porgram receives > Storage_Error and not SIGKILL. The easiest way to do this is to specify the storage size for the access type: type S is access ...; for S'Storage_Size use ...; -- in storage elements ALRM 3.11(18): If Storage_Size is specified for an access type, then the Storage_Size of this pool is at least that requested, and the storage for the pool is reclaimed when the master containing the declaration of the access type is left. If the implementation cannot satisfy the request, Storage_Error is raised at the point of the attribute_definition_clause. If neither Storage_Pool nor Storage_Size are specified, then the meaning of Storage_Size is implementation defined. -- Simon Wright 100% Ada, no bugs.