I think, the problem might be there: every child continues the loop after sleep 1 and creates more and more grandchildren. Placing exit after sleep fixed the issue for me: before after.$pid = fork; if ($pid == 0){ # Is a child $iterations++; sleep 1; } ... } } if ($pid == 0){ # Is a child exit; }
By the way, separate shell with ulimit -u 300 was very useful for testing this code.
In reply to Re: Help with Fork bomb
by aitap
in thread Help with Fork bomb
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |