Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jul 1999 11:54:50 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Dag-Erling Smorgrav <des@flood.ping.uio.no>
Cc:        Kelly Yancey <kbyanc@alcnet.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Overcommit and calloc()
Message-ID:  <19990719115450.A45503@dan.emsphone.com>
In-Reply-To: <xzpyagclhl8.fsf@flood.ping.uio.no>; from "Dag-Erling Smorgrav" on Mon Jul 19 18:39:15 GMT 1999
References:  <001f01bed205$e8aeecc0$291c453f@kbyanc.alcnet.com> <xzpyagclhl8.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 19), Dag-Erling Smorgrav said:
> "Kelly Yancey" <kbyanc@alcnet.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990719115450.A45503>