Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>fork</code>-ing requires resources, since it is <a href="http://en.wikipedia.org/wiki/Copy-on-write" rel="nofollow">copy-on-writing</a> the writable pages of the process. Read again the <a href="http://man7.org/linux/man-pages/man2/fork.2.html" rel="nofollow">fork(2)</a> man page.</p> <p>You could at least provide a huge temporary swap file. You could create (on some file system with enough space) a huge file <code>$SWAPFILE</code> with</p> <pre><code> dd if=/dev/zero of=$SWAPFILE bs=1M count=256000 mkswap $SWAPFILE swapon $SWAPFILE </code></pre> <p>Otherwise, you could for instance design your program differently, e.g. <code>mmap</code>-ing some big file (and <code>munmap</code>-ing it just before the fork, and <code>mmap</code>-ing it again after), or more simply starting at the beginning of your program a <code>popen</code>-ed shell, or a <code>p2open</code>-ed one or making explicitly the <code>pipe</code>-s to and from it (probably a multiplexing call à la <code>poll</code> would also be useful), and later issue commands to it.</p> <p>Maybe we could help more if we had an idea of what your program is doing, why does it consume so much memory, and why and what is it forking...</p> <p>Read <a href="http://advancedlinuxprogramming.com/" rel="nofollow">Advanced Linux Programming</a> for more.</p> <h3>PS.</h3> <p>If you <code>fork</code> just to run <code>gdb</code> to show the backtrace, consider simpler alternatives like <a href="https://github.com/mirrors/gcc/tree/master/libbacktrace" rel="nofollow">recent GCC's libbacktrace</a> or <a href="http://freecode.com/projects/libbacktrace" rel="nofollow">Wolf's libbacktrace</a>...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload