From owner-freebsd-stable@FreeBSD.ORG Thu Jul 24 08:59:32 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 01A8237B401 for ; Thu, 24 Jul 2003 08:59:32 -0700 (PDT) Received: from smithers.nildram.co.uk (smithers.nildram.co.uk [195.112.4.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 163B143F85 for ; Thu, 24 Jul 2003 08:59:31 -0700 (PDT) (envelope-from muttley@nildram.co.uk) Received: from UebiMiau (jupiter2.nildram.co.uk [195.112.4.138]) by smithers.nildram.co.uk (Postfix) with SMTP id 7305F231C11; Thu, 24 Jul 2003 16:59:26 +0100 (BST) Received: from client 194.62.232.65 for UebiMiau2.7 (webmail client); Thu, 24 Jul 2003 16:59:30 +0100 Date: Thu, 24 Jul 2003 16:59:30 +0100 From: "Muttley" To: "Chuck Swiger" , "freebsd-stable@freebsd.org"@smithers.nildram.co.uk X-Priority: 3 X-Mailer: UebiMiau 2.7 X-Original-IP: 194.62.232.65 Content-Transfer-Encoding: 8bit X-MSMail-Priority: Medium Importance: Medium Message-Id: <20030724155926.7305F231C11@smithers.nildram.co.uk> X-Mailman-Approved-At: Thu, 24 Jul 2003 14:16:40 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: Re: malloc does not return null when out of memory X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Muttley List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jul 2003 15:59:32 -0000 Yes, I thought briefly about something like this. Then I thought 'there's a race condition'. Then I realised that other processes might not link against this malloc. Then I realised the race condition doesn't even matter; processes will still be killed, as the kernel doesn't care that you're still in malloc() when the overcommitted memory is touched, it just knows you've touched it and there's no actual memory there. This will result in far more processes being killed. I believe that's a bad thing. Any patch for this is going to have to be in kernelland not userland. Cheers, Matt From: "Chuck Swiger" Date: 24/07/03 15:16 I don't think the following is a particularly good idea, as the existing prezero ('Z') or junk ('J') options will also serve to reference memory and prevent the "memory overcommit issue", but: