Why kernel kills processes that run out of memory instead of
just failing memory allocation system calls?
Dag-Erling Smørgrav
des at des.no
Fri May 29 09:49:23 UTC 2009
Alfred Perlstein <alfred at freebsd.org> writes:
> Dag-Erling Smørgrav <des at des.no> writes:
> > Usually, what you see is closer to this:
> >
> > if ((pid = fork()) == 0) {
> > for (int fd = 3; fd < getdtablesize(); ++fd)
> > (void)close(fd);
> > execve(path, argv, envp);
> > _exit(1);
> > }
>
> I'm probably missing something, but couldn't you iterate
> in the parent setting the close-on-exec flag then vfork?
This is an example, Alfred. Like most examples, it is greatly
simplified. I invite you to peruse the source to find real-world
instances of non-trivial fork() / execve() usage.
DES
--
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-hackers
mailing list