sbrk(2) question

Richard Tobin richard at aiai.ed.ac.uk
Mon Mar 11 23:44:04 AEST 1991


In article <1991Mar8.180132.12025 at Think.COM> barmar at think.com (Barry Margolin) writes:
>This question came up at work yesterday: when sbrk(2) is used to increase
>the size of the data segment, is the newly-allocated memory guaranteed to
>be empty?

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.

-- Richard

-- 
Richard Tobin,                       JANET: R.Tobin at uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed at nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin



More information about the Comp.unix.questions mailing list