c - Do mmap/mprotect-readonly zero pages count towards committed memory? -
i want keep virtual address space reserved in process memory used not presently needed. i'm interested in situation host kernel linux , it's configured prevent overcommit (which detailed accounting committed memory).
if want prevent data application no longer using occupying physical memory or getting swapped disk (wasting resources either way), can madvise
kernel it's unneeded, or mmap
new 0 pages on top of it. neither of these approaches reduce amount of memory counts committed, other processes prevented using.
what if replace pages fresh 0 pages marked read-only? intent don't count towards committed memory, , further can later use mprotect
make them writable, , fail if making them writable go on committed memory limit. understanding correct? work?
if you're not using page (reading or writing it), won't commited address space (only reserved).
but address space limited, can't play want/like it.
see example electricfence may fail large number of allocations, because of insertion of "nul page/guard page" (anonymous memory no access). have @ these thread : "mprotect() failed: cannot allocate memory" : http://thread.gmane.org/gmane.comp.lib.glibc.user/538/focus=976052
Comments
Post a Comment