[squeak-dev] How to find unclosed file handles in Squeak?

Levente Uzonyi leves at caesar.elte.hu
Thu Oct 1 19:58:58 UTC 2020


Hi Christoph,

On Thu, 1 Oct 2020, Thiede, Christoph wrote:

> 
> Simple question, probably we already have a helper method for it, but I did not found any yet:
> 
> Often, way too often, I encounter some old code (or some stupid code written by myself) that uses #readStream to read a file and forgets to close it again.
> 
> Apart from the fact that #readStream is a quite dangerous selector, I wish I could find these unclosed file streams and close them manually without restarting my entire image.
> 
> Is there any quick way to do this? "Smalltalk snapshot: false andQuit: false" does not seem to do the trick, and I would prefer a less brutal approach.
> 
> Something like "Utilities exploreUnclosedFileStreams" would be perfect ...

Try this: StandardFileStream registry.
Note that you can't just close all files there, but the files you are 
looking for are there.


Levente

> 
> 
> Best,
> 
> Christoph
> 
> 
>


More information about the Squeak-dev mailing list