[squeak-dev] FileStreams Limit
Levente Uzonyi
leves at caesar.elte.hu
Thu Feb 17 16:19:09 UTC 2022
Hi Jörg,
On Thu, 17 Feb 2022, Jörg Belger wrote:
> The least I expect is that I get a debugger in Smalltalk when the limit is reached and not a Squeak that is not reactive and consumes 100% cpu time. But anyway I get the hanging Squeak already with 242 file streams, independent if I set the #maxExternalSemaphores to 8192.
Squeak is trying to be optimistic and assumes that files can be opened but
the descriptors are consumed by abandoned but unclosed files. Doing a GC
will trigger the automatic closing of such files freeing up the file
descriptors.
>
> If I do the same in VisualWorks and open 4000 write streams I have no problems with limits, so I guess it is not an operating system limit, it is a Squeak VM limit. There is no reason why everything needs to be implemented in C code, the goal should be to implement as much as we can in Smalltalk.
>
> The reason why I opened so much files is that the Squeak file API is very slow for my realtime streaming, so I simply leave the files open.
> Here is an example:
>
> VisualWorks needs 700ms
> Time millisecondsToRun:
> [| filename |
> filename := 'test.txt' asFilename.
> 10000 timesRepeat:
> [filename readWriteStream close]]
>
> Squeak needs 4000ms
> Time millisecondsToRun:
> [10000 timesRepeat: [(FileStream fileNamed: 'test,txt‘) close]]
>
> If you can tell me a faster way to open/write/close a file it would be nice.
On my machine (linux) I get 145ms. Are you on Windows?
Levente
More information about the Squeak-dev
mailing list
|