comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: Is the Ada run-time required to detect out-of-memory
Date: Tue, 25 May 2004 23:19:21 +0200
Date: 2004-05-25T23:18:32+02:00	[thread overview]
Message-ID: <87pt8sfbmu.fsf@insalien.org> (raw)
In-Reply-To: uOudnR-nzbFlMi7dRVn-vw@comcast.com

"Robert I. Eachus" writes:
> Ludovic Brenta wrote:
>
>> 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.
>
> Did you refile the bug against the kernel?

No, I didn't.  As explained above, I leave this to the OP to decide
whether or not the current behaviour is a problem.

> As I understand it now, the problem is not that the kernel raises
> SIGKILL if physical RAM is exhausted, but that malloc doesn't check
> that the allocation can succeed before making it.
> 
> Having said that, I suspect that this should be a low priority bug,
> and it will be pretty hard to fix.  It may take adding a version of
> malloc that does the check, and leaving the decision as to which one
> to call to the compiler run-time.  (GNAT should then use the new call
> when allocating storage pools, and probably continue using the current
> version for allocations in the default storage pool.

As Duncan pointed out, a version of malloc that does the check would
be very difficult to write indeed.  It would have to hook directly
into the kernel's memory manager in order to know which pages are
swapped out, which ones are dirty, and so on.  Note that it would have
to switch paradigms in the process, from arbitrary-sized chunks to
pages and from user space to kernel space.  This also would break the
whole purpose of some important design decisions made in Linux.

Personally, I would just leave it at that.  If someone needs more
deterministic behaviour than Linux provides, they should be using a
real-time kernel without any virtual memory.

-- 
Ludovic Brenta.



  parent reply	other threads:[~2004-05-25 21:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-20 22:54 Is the Ada run-time required to detect out-of-memory conditions? Ludovic Brenta
2004-05-21  0:44 ` Georg Bauhaus
2004-05-21  0:47 ` Stephen Leake
2004-05-21  0:54   ` Georg Bauhaus
2004-05-21  1:00     ` Stephen Leake
2004-05-21  3:29 ` Robert I. Eachus
2004-05-21  8:04 ` Vinzent 'Gadget' Hoefler
2004-05-21  9:34   ` Martin Krischik
2004-05-21 11:13 ` Wojtek Narczynski
2004-05-21 12:55   ` Martin Krischik
2004-05-21 16:00     ` Robert I. Eachus
2004-05-21 17:13       ` Ludovic Brenta
2004-05-21 23:41         ` Wojtek Narczynski
2004-05-23  8:20       ` Martin Krischik
2004-05-21 19:58   ` Randy Brukardt
2004-05-21 16:56 ` Mark H Johnson
2004-05-21 17:19   ` Ludovic Brenta
2004-05-21 21:39 ` user
2004-05-21 22:04   ` Ludovic Brenta
2004-05-21 22:11     ` Ludovic Brenta
2004-05-22 11:40       ` Simon Wright
2004-05-25 20:43     ` Is the Ada run-time required to detect out-of-memory Robert I. Eachus
2004-05-25 20:58       ` Duncan Sands
2004-05-25 21:19       ` Ludovic Brenta [this message]
2004-05-25 21:31         ` Duncan Sands
2004-05-26  7:09       ` Martin Krischik
2004-05-26  7:38         ` Duncan Sands
2004-05-26  8:16           ` Martin Krischik
2004-05-26  8:34             ` Duncan Sands
2004-05-26 16:20               ` Martin Krischik
2004-05-22 13:40   ` Is the Ada run-time required to detect out-of-memory conditions? Duncan Sands
2004-05-22 14:09     ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox