-
Notifications
You must be signed in to change notification settings - Fork 6
release tcp messages from memory #92
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
Conversation
|
I would tend to prefer handling this inside of the It is not so bad considering it is all in the same package, but |
|
Further, I would have to think harder on this to be sure that this particular clearing location would not risk missing messages |
|
could push the job to def feed(self, data: bytes):
# Must support random access, if it does not, must be fed externally (e.g. TCP)
pos = self._file.tell()
self._file.seek(0, 2)
if pos == self._file.tell():
# read reached EOF and we are safe to clear
self._file = io.BytesIO()
pos = 0
self._file.write(data)
self._file.seek(pos)
self.new_data.set()This puts the rewrite inside of Unpacker and should ensure we don't miss messages. The con is that clearing the file is less scheduled and we might run into an issue where |
|
@ksunden lmk what you think of Unpacker's |
|
okay, using file-like methods to clear _file, rather than explicitly creating a new BytesIO object. No conflict with |
|
Thanks for finding this memory leak @ddkohler @ksunden and I spent quite a while thinking about how the whole unpacker process could be better, see the story in #97 In the interest of getting this leak fixed right now, I like your solution @ddkohler. Going to merge and release this and hopefully we can come around and make a better solution e.g. #97 at a later date |
|
(we did think about this implementation and decided that it's not going to cause any problems, it's purely better than what we had before) |
Uh oh!
There was an error while loading. Please reload this page.