Re: sbrk(2) broken

From: Kris Kennaway <kris_at_FreeBSD.org>
Date: Fri, 04 Jan 2008 12:31:07 +0100
Igor Mozolevsky wrote:
> On 04/01/2008, Dag-Erling Smørgrav <des_at_des.no> wrote:
> 
>> For the same reason as it has for the last 20 years or so: memory
>> overcommit, which means that malloc() allocates address space, not
>> memory.  Actual memory is allocated on-demand when the address space is
>> used (read from or written to).  If there is no RAM left and none can be
>> freed by swapping out, the process gets killed.  The process that gets
>> killed is not necessarily the memory hog, it is merely the process that
>> is unlucky enough to touch a new page at the wrong moment, i.e. when all
>> RAM and swap is exhausted *or* everything in RAM is wired down and
>> unswappable.
> 
> Broadcasting SIGDANGER would be a much better option; followed by
> SIGTERM to the memory hogger (to allow for graceful termination) and
> only then SIGKILL. I can imagine a few (legitimate) scenarios when a
> user process would want to hog as much RAM as possible...

Do everyone a favour and research the topic in the archives, please. 
Another thread on the subject will just waste everyone's time.

Kris
Received on Fri Jan 04 2008 - 10:31:15 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:24 UTC