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

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Oct 1 20:31:15 UTC 2020


Hi Karl, Hi Levente,


> Stream allSubInstances ?


I tried this earlier today, but when I filtered the very long list for streams that are open and whose fullName is notNil, I did not find the relevant files.
<http://www.hpi.de/>

> Try this: StandardFileStream registry.

Thank you, this looks promising! I will try it if I encounter a similar problem the next time. :-)

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Levente Uzonyi <leves at caesar.elte.hu>
Gesendet: Donnerstag, 1. Oktober 2020 21:58:58
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] How to find unclosed file handles in Squeak?

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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201001/71471431/attachment.html>


More information about the Squeak-dev mailing list