From owner-freebsd-current@FreeBSD.ORG Fri Jan 4 11:31:15 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D79DC16A41B; Fri, 4 Jan 2008 11:31:15 +0000 (UTC) (envelope-from kris@FreeBSD.org) Received: from weak.local (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7A07213C461; Fri, 4 Jan 2008 11:31:09 +0000 (UTC) (envelope-from kris@FreeBSD.org) Message-ID: <477E18FB.3040205@FreeBSD.org> Date: Fri, 04 Jan 2008 12:31:07 +0100 From: Kris Kennaway User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Igor Mozolevsky References: <477C82F0.5060809@freebsd.org> <863ateemw2.fsf@ds4.des.no> <20080104002002.L30578@fledge.watson.org> <86bq81c12d.fsf@ds4.des.no> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , freebsd-current@freebsd.org, Robert Watson , Jason Evans Subject: Re: sbrk(2) broken X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 11:31:15 -0000 Igor Mozolevsky wrote: > On 04/01/2008, Dag-Erling Smørgrav 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