Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!mouse From: mouse@thunder.mcrcim.mcgill.edu (der Mouse) Newsgroups: comp.unix.questions Subject: Re: sbrk(2) question Message-ID: <1991Mar15.100722.13774@thunder.mcrcim.mcgill.edu> Date: 15 Mar 91 10:07:22 GMT References: <1991Mar8.180132.12025@Think.COM> <4296@skye.ed.ac.uk> <6582@auspex.auspex.com> Organization: McGill Research Centre for Intelligent Machines Lines: 18 In article <6582@auspex.auspex.com>, guy@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@larry.mcrcim.mcgill.edu