On Tue, Apr 26, 2011 at 11:41 AM, RW <[email protected]> wrote: >> The above quote states that the memory not occupied by the remapped >> object is zero filled. Which is to say that memory allocated by >> mmap() is either filled with new data or filled with zeros. > > In context it says: > > "If len is not a multiple of the page-size, the mapped region > may extend past the specified range. Any such extension beyond the > end of the mapped object will be zero-filled." > > To me the most straightforward reading of that is that it's > referring to non-aligned address ranges. > > Your interpretation may well be the intended one, but where would > that leave the anonymous mappings used by malloc? Are we to think > of them as extensions beyond a non-existent mapped object, and thus > infer that they are zero-filled? It's a bit of a stretch from > what's written.
malloc() uses either sbrk or mmap to extend the heap. As far as I know, sbrk extends the heap with zero filled memory. According to the man page, mmap extends it either with remapped data, or with remapped data plus additional zero filled memory. This answers the original poster's question. If you've gone on to a different issue then I apologize for not following you. _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[email protected]"
