--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

I often use constructions like the following:

os  O.popen('uname -sr').readlines.to_s.strip

I assume that the Garbage Collector throws away the IO instance created
by IO::popen, because it's simply not needed after that line anymore.

What I've experienced is, that it leaves a zombie for each time I use
such an instruction.

---

loop {
  zombies  O.popen('ps ax|grep defunct|wc -l').readlines.to_s.strip
  puts "Number of zombies: #{zombies}"
}

---

This code produces about 100 defunct processes in about 2 seconds.
Operating system is FreeBSD 6.1-RC.

However, if I close the IO object manually, defunct processes stay
constantly at 2-3.

---

loop {
  io  O.popen('ps ax|grep defunct|wc -l')
  zombies  o.readlines.to_s.strip
  io.close
  puts "Number of zombies: #{zombies}"
}

---

Is this assumed behaviour or a bug? I guess there's a close(2) or
waitpid(2) missing in the IO code...

Stephan.

--4Ckj6UjgE2iN1+kY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (FreeBSD)

iD8DBQFEQ8iouKMfCHUX8x0RAndkAJsEwQ843ymge/a6ge7bYfghPU2klQCgssKw
MIGJTmeNJjmU9q44kFR2ZFolt
-----END PGP SIGNATURE-----

--4Ckj6UjgE2iN1+kY--