Memory Regions displayed in SMAPS output with no permissions
If I see the output of cat /proc//smaps, I find that there are some memory regions with which no read/write/execute permissions have been associated. Also these region are mapped to inode number 0.
I wanted to know how does a region end up in such a state? Is it some sort of memory leak?
Can these regions开发者_运维百科 be ever used again by the process?
They're not leaks. They're created by calling mmap()
with the MAP_ANONYMOUS
and PROT_NONE
flags. The process can still use that virtual address space: it could unmap the regions with munmap()
, or alter the protections with mprotect()
.
Such regions are typically used to set up guard pages, which are intended to trigger a signal when a growing data structure grows beyond its current bound.
精彩评论