From owner-freebsd-hackers Mon Jul 19 9:55: 2 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 0856215250 for ; Mon, 19 Jul 1999 09:54:56 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id LAA46290; Mon, 19 Jul 1999 11:54:50 -0500 (CDT) (envelope-from dan) Date: Mon, 19 Jul 1999 11:54:50 -0500 From: Dan Nelson To: Dag-Erling Smorgrav Cc: Kelly Yancey , freebsd-hackers@FreeBSD.ORG Subject: Re: Overcommit and calloc() Message-ID: <19990719115450.A45503@dan.emsphone.com> References: <001f01bed205$e8aeecc0$291c453f@kbyanc.alcnet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: ; from "Dag-Erling Smorgrav" on Mon Jul 19 18:39:15 GMT 1999 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Jul 19), Dag-Erling Smorgrav said: > "Kelly Yancey" writes: > > Ahh...but wouldn't the bzero() touch all of the memory just > > allocated functionally making it non-overcommit? > > No. If it were an "non-overcomitting malloc", it would return NULL > and set errno to ENOMEM, instead of dumping core. It should be possible to modify calloc to trap signals, then bzero. If bzero faults, you free the memory and return NULL. No, wait. You can't trap SIGKILL. How about this. mmap() some anonymous memory MAP_SHARED, fork a child to bzero it. If the child dies, unmmap and return NULL. If the child succeeds, use the memory. This memory won't be freeable with malloc(), though. -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message