mirror of
https://github.com/kokarare1212/librespot-python.git
synced 2026-04-25 08:35:49 +03:00
[GH-ISSUE #141] [BUG] Memory Leak #21
Labels
No labels
bug
dependencies
duplicate
enhancement
invalid
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot-python-kokarare1212#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @owlwang on GitHub (Jul 15, 2022).
Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/141
Hi, thank you for making this very useful project, it's really awesome.
I'm experiencing a suspected memory leak during my use.
When load a large batch of songs, I can see the memory usage slowly growing.
I'd like to ask you if there are any areas I can look at to help locate a fix for this memory leak?
My environment is Ubuntu 20 and python 3.8.
sample code:
@kokarare1212 commented on GitHub (Jul 15, 2022):
Side note:
@owlwang commented on GitHub (Jul 15, 2022):
Okay.
@owlwang commented on GitHub (Jul 21, 2022):
Hi, @kokarare1212
Hope you can notice this issue.
I've located the memory leak.
Python's GC doesn't seem to recycle the used buffer, so every time a song is loaded it stays in memory permanently.
Temporary solution
Add a method to clear the buffer in the InternalStream class
Call the clear_buffer() method in the close method of the AbsChunkedInputStream class
Then after each read(), call close() method.
Hope you can fix this problem in main branch code.
@kokarare1212 commented on GitHub (Jul 21, 2022):
Yes, that is because the buffer has not been released.
@owlwang commented on GitHub (Jul 21, 2022):
Thanks for your work!
@staniel359 commented on GitHub (Aug 30, 2022):
@kokarare1212 When will these changes be released?
@kokarare1212 commented on GitHub (Aug 30, 2022):
OK, I have published.
https://github.com/kokarare1212/librespot-python/releases/tag/v0.0.6
@staniel359 commented on GitHub (Aug 31, 2022):
@kokarare1212 Thank you.