News for hackers. Stuff that matters.
Re:Memory FAQ by waynecochran on Monday October 10, 2016 @07:15PM (#12680528)
I always wondered if forking a giant processes (i.e., large memory footprint) to create a small processes caused a lot of needless memory to be allocated, but now I understand why its no big deal:

    For example, the fork/exec combo creates transient virtual memory usage
    spikes, which go away again almost immediately without ever breaking the
    copy on write status of most of the pages in the forked page tables. Thus
    if a large process forks off a smaller process, enormous physical memory
    demands threaten to happen (as far as overcommit is concerned), but never
    materialize.
Re:Memory FAQ by paulfurtado on Monday October 10, 2016 @08:41PM (#12681077)
Note that this also occasionally results in "failure to fork" with the default linux overcommit setting. At fork-time if there isn't enough memory to duplicate the entire process, the fork call fails, even though you never intended to use that memory. You can use vfork to get around this.
Re:Memory FAQ by swiley on Tuesday October 11, 2016 @12:03AM (#12681798)
I believe the fork() manpage (or at least the clone() manpage) actually mentions this.