-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider explicit deletion of stream objects on exit #8
Comments
#3 is sort of related, and on its way to being solved. I think |
In most modern contexts, for anything but the most ridiculous of large streams, I can't imagine this Issue is likely to be a big issue. Seems very YAGNI. Especially with the changes from #25 and #26, though -- as you noted at the bottom of #26, the mocked stream objects are now storing internal references to the underlying buffers in some situations, and that could lead to memory accumulation if enough things stay in scope/have references. |
Although -- both I guess But for So, yeah: just |
With #58 switching the persisted-content mechanism from |
I think we at least need tests for this, and it turns out to be very important to delete objects when using TemporaryFile and when using the real sys handles. |
Depends on the balance between the number of times
stdio_mgr
is used, the frequency of calls, and the frequency of suitable garbage collection.Prompted by this SO answer. That example uses a class for the context manager, though, with a recommendation to retain the instance for storing the captured stream contents. With
stdio_mgr
being implemented as a function, especially one where the streams are closed on context exit, there may not be as big of a problem with memory consumption.The text was updated successfully, but these errors were encountered: