Hi,

In the man page of mmap(2), the description of the flag MAP_ANON does
not indicate the state of the newly allocated memory.

Is it zero-initialized? Or is it undefined?

(The MAP_ANON flag allows us to use the mmap system call to allocate
dynamic memory during program execution.)

In the NetBSD man page, it is clearly stated that with this flag
enabled, "The mapped memory will be zero filled":
https://netbsd.gw.com/cgi-bin/man-cgi?mmap

In the Linux man page, it is also clearly stated that "[The mapping]
contents are initialized to zero":
http://man7.org/linux/man-pages/man2/mmap.2.html

Reply via email to