sbrk(2) question

Barry Margolin barmar at think.com
Sat Mar 9 04:01:32 AEST 1991


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?  The man page (on SunOS 4.1.1 and Ultrix 3.x) doesn't say
anything about the contents of the new memory.  For security reasons it
makes sense that data from an old process should not slip into another
process's address space, but this is Unix so I don't think such assumptions
are always safe :-(

Assuming most implementations provide zero-filled memory, is this generally
done using some kind of optimization of all-zero memory pages, or does it
have to explicitly zero lots of memory and swap space pages (assuming you
give sbrk() a large value)?

--
Barry Margolin, Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.unix.questions mailing list