Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Feb 1999 20:52:28 -0500 (EST)
From:      "John S. Dyson" <dyson@iquest.net>
To:        tlambert@primenet.com (Terry Lambert)
Cc:        dyson@iquest.net, toasty@home.dragondata.com, mike@smith.net.au, hackers@FreeBSD.ORG
Subject:   Re: vm_page_zero_fill
Message-ID:  <199902170152.UAA00758@y.dyson.net>
In-Reply-To: <199902162246.PAA08400@usr08.primenet.com> from Terry Lambert at "Feb 16, 99 10:46:46 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert said:
> > > Perhaps a change that would allow for malloc()'ed and new'ed memory to be
> > > able to take memory from the to-be-zero'ed list would be better, although
> > > that may be more work than I'm looking for....
> >
> > That *might* be reasonable.  A special sbrk or somesuch.  That sbrk
> > would make a non-prezeroed map entry.  vm_fault would just avoid
> > doing the zero.
> 
> Expecting sbrk'ed pages to be zero filled is just *wrong*.
> 
Actually, you have to support that on most practical architectures.

>
> Sorry, but there is a *reason* that there are seperate malloc(3)
> and calloc(3) routines.  The former is seperate from the latter
> because uncleared pages are supposed to occur faster, and because
> there was an expectation that the malloc(3) could return space
> already allocated to the process.  Indeed, the ANSI C specification
> practically *prohibits* breaking memory back to the system, since
> it *requires* that a free'd region of a given size be re-malloc'able
> without a check of the malloc return code (though it doesn't
> guarantee contents).
> 
> 
malloc and calloc are different.  Memory is often recycled in the
address space when using malloc.  sbrk is a security violation if
the pages aren't prezeroed (or defined to be something other than
data in other processes or freed data from the kernel :-)).

-- 
John                  | Never try to teach a pig to sing,
dyson@iquest.net      | it makes one look stupid
jdyson@nc.com         | and it irritates the pig.


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?199902170152.UAA00758>