sbrk(2) question

der Mouse mouse at thunder.mcrcim.mcgill.edu
Fri Mar 15 20:07:22 AEST 1991


In article <6582 at auspex.auspex.com>, guy at auspex.auspex.com (Guy Harris) writes:
>> 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).
> 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.

True.  The problem is that releasing of memory, in this sense, happens
with page granularity.  And unless your page size is one byte, this
means it's possible for some garbage to be left at the end of the last
valid page, above the sbrk()-set end pointer.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.unix.questions mailing list