News for hackers. Stuff that matters.
Re:When the memory allocator works against you by gcr on Sunday March 12, 2017 @12:57PM (#13851613)
After a fork, does the amount of committed memory increase by the size of the child's allocated virtual memory space?

I'm curious how committed memory interacts with COW fork semantics. After all, a child can just overwrite the COW/copy of the memory it inherited from its parent without allocating anything else.

Re:When the memory allocator works against you by haldean on Sunday March 12, 2017 @01:42PM (#13851878)
No, all of the child's memory mappings are shared with its parent. Upon write, though, that becomes a new committed mapping; I believe the entire page is copied, so you could end up committing another 4k with a one-byte write from the child.
Re:When the memory allocator works against you by gcr on Sunday March 12, 2017 @09:08PM (#13854453)
Hm. Then suppose I turn off the OOM killer. What happens to a process that writes to its parent's page if the system has no memory left to commit?
Re:When the memory allocator works against you by tedunangst on Sunday March 12, 2017 @02:11PM (#13852076)
COW is usually a kind of loophole. Most systems only count the pages once (otherwise you'd have to reject the fork, but that becomes inconvenient fast).