-
Notifications
You must be signed in to change notification settings - Fork 843
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
Memory leak #13
Comments
Hmm... you're definitely right that there's a memory leak somewhere. I think it has something to do with the form, but I'm not entirely sure. I'll work on figuring out what's happening. |
This might be a limitation in Go. |
so nothing we can do about it ? I can confirm that |
Well, this commit will reduce memory usage, a 30MiB test file increases my memory usage by ~2MB. That upload function is pretty much identical to mine, so I don't know what the difference could be. |
I just tried it out, it is a great improvement. |
If in the future anyone comes up with a better solution, I'd be happy to reopen this. Until then, I'm going to close it. |
Instructions on how to use `OvyFlash/telegram-bot-api` by replacing the original dependency
Sending large files with
SendDocument
orSendVideo
will result in high memory usage, and after the file done sending, this memory won't get freedconsider the following code
Now running this bot on OS X will start with
8.2 MB
ofReal Mem
"according toActivity Monitor
"after sending the first message, the bot will start sending
file.dat
,Real Mem
will jump to107.6 MB
it will finish sending but it will not free the memory, requesting the file again will riseReal Mem
again to180 MB
... etcI took a look at the code and I figured it has to be in the
UploadFile
method, and I found that a usage toos.Open()
bond to a variable calledf
hasn't get closed, I tried closing it, but it did not solve the problem.The text was updated successfully, but these errors were encountered: