-
Notifications
You must be signed in to change notification settings - Fork 122
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
Don't buffer all the data in memory when writing, reducing peak memory usage #256
Conversation
My one concern here is that Windows semantics might be a problem. I will submit a separate PR to switch CI to using GitHub Actions, then merge this forward. |
I ran tests using the GitHub Actions setup in #257. It works fine on Windows, but fails on Python 2.7 where mmap objects don't support the buffer API. There are two solutions, I am happy to implement both:
Please let me know which you prefer and I will submit a PR or update a PR (but I recommend merging #257 first). |
@ionrock OK this is now ready for review. |
@@ -62,8 +82,8 @@ def _close(self): | |||
# and allows the garbage collector to do it's thing normally. | |||
self.__callback = None | |||
|
|||
# Closing the BytesIO stream releases memory. Important when caching | |||
# big files. | |||
# Closing the tempoary file releases memory and frees disk space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: s/tempoary/temporary/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixes #145.
Before:
After:
In both cases running the script from #145 (comment) using
fil-profile run example.py
.