[fpc-pascal] TProcess and zombie processes in *nix systems

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue Jan 21 21:40:43 CET 2020


In fgGUI applications I often launch other applications. eg: The help
viewer etc. In such cases, I simply want to launch the application and
then forget about it. I have no need to read any stdout etc.

I've been using TProcess for this task as follows:

  p := TProcess.Create(nil);
    p.Executable := ...

As TProcess is a TComponent descendant, I specify nil as the Owner, thus
I manually free it. It was brought to my attention that if the user has
a long running application (eg: an RSS feed reader - lunching a web
browser via TProcess), after a while they have many Zombie processes in
Linux hanging around until the fpGUI application terminates.

Two things:

  1.  The way I create the TProcess. Why or how does it have
      a dependency on the fpGUI application?

  2.  Anybody else experience this zombie processes hanging
      around in *nix systems? Is there any option in TProcess
      to prevent that?

ie: I want to launch a new application in a separate OS process and then
forget about it.


More information about the fpc-pascal mailing list