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

David T. Lewis lewis at mail.msen.com
Sat Feb 7 02:58:06 UTC 2015


On Wed, Feb 04, 2015 at 11:04:06AM +0100, Herbert K?nig wrote:
> Hi Dave,
> 
> >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
> 
> thanks, these helped a lot.
> 
> >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?
> 
> I have been doing embedded with scarce RAM and now I play with home 
> automation (in a very broad sense) which is supposed to run 24/7 me 
> being abroad and my family not programming.
> 
> From this perspective my immediate instinct is to not collect the 
> instances at all.  Now that I know about the fact I prefer to remove 
> them myself. But I'm sure other users have a different perspective on 
> this and you might break somebody's code if you wouldn't collect them at 
> all.
> 
> I former uses I collected the processes myself (to kill them, query 
> their state) and for that purpose wouldn't want to pick them out of a 
> dictionary.
> 
> I'm very interested in learning when this dictionary comes in handy or 
> is needed because I see many methods referencing allMyChildren but most 
> of them are not sent in my image so I can't find out.


Hi Herbert,

I think I finally came up with a way to handle this problem in a better way.
I changed the child process registry to be a list of recent child processes,
and set it up so the list gets pruned to a reasonable size every time a new
child process is registered. I kept "OSProcess thisOSProcess allMyChildren"
as a way to get a dictionary of recent child processes, so this is still easy
to browse as before.

For your application with home automation, you should see the child process
list maintained at a maximum size of 20, trimmed continuously as each new
process is started.

The update on squeaksource.com is:

  Name: OSProcess-dtl.95
  Author: dtl
  Time: 6 February 2015, 9:02:45.087 pm
  UUID: aaffb554-75d2-406d-be2b-f9d83428f6a8
  Ancestors: OSProcess-dtl.94
  
  OSProcess 4.5.16
  
  The allMyChildren registry is convenient for browsing, but should not
  be allowed to accumulate exited children without limit. Change it from a
  dictionary to an ordered collection, retaining #allMyChildren as a method
  that answers a dictionary of process proxies by pid. Internally keep a
  list of recent children, and prune the list to a reasonable size each
  time a new child process is registered.

Dave



More information about the Squeak-dev mailing list