[squeak-dev] How to get rid of instances of ExternalUnixOSProcess

David T. Lewis lewis at mail.msen.com
Wed Feb 4 00:01:44 UTC 2015


On Tue, Feb 03, 2015 at 02:49:54PM +0100, Herbert K??nig wrote:
> Hi,
> 
> I start external OS processes via the class side method command:
> The returned instances correctly show runState #complete but the 
> instances won't get garbage collected.
> Pointer Finder gets me ThisOSProvess allMyChildren.
> 
> I start the external program every few seconds so the instances accumulate.
> 
> So should I manually send unregisterChildProcess: or should I reuse one 
> instance of ExternalUnixOSProcess via repeated forkChild  to restart the 
> program? Or something completely different?

All of the child processes that run in your current Squeak session (beginning
when you start the image) are saved in a dictionary. This is just to make
them browsable (OSProcess thisOSProcess allMyChildren).

Unregistering each child process, as you suggest above, will work fine, at
least after fixing the bug that you found (thank you for that, it is updated
on squeaksource now).

But you can also clean up all of the terminated processes like this:

  OSProcess thisOSProcess discardExitedChildren

Or you can empty the dictionary completely:

  OSProcess thisOSProcess resetChildProcessDictionary

I never implemented anything to automatically clean up the child process
dictionary because it did not really seem necessary based on how I was
using OSProcess. But for the kind of thing you are doing (restart a new
process every few seconds, maybe for a long time) I can see that it might
be a real problem. Do you think that this should be changed?

Thanks,

Dave



More information about the Squeak-dev mailing list