sbrk(2) question

Guy Harris guy at auspex.auspex.com
Wed Mar 13 04:56:18 AEST 1991


>There's one case where it amlost certainly won't be zero, which is when
>memory has been previously alocated and released (eg by calling sbrk()
>with a negative argument).  So it's unwise to rely on it even if the
>operating system allocates zeroed (or zero-fill-when-referenced) pages.

Umm, why would it not be zero in that situation?  If the memory has
truly been released, as in "handed back to the kernel", it should be
re-zeroed if allocated to a process again.  (I.e., calling "sbrk()" with
a negative argument, in most if not all versions of UNIX, doesn't just
set some user-mode pointer so that the memory stays in the address space
of the process.)



More information about the Comp.unix.questions mailing list