You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling the keyring.get_password() function repeatedly on MacOS results in leaked memory. The problem appears to be in find_generic_password(), where the memory allocated by SecItemCopyMatching() is never released. I spent some time trying to fix the issue, but it was dragging me further into the world of CoreFoundation internals than I had time to go.
I don't know how serious the problem is in practice, but using memray I was seeing a non-negligible memory allocation (~30MB) hanging around in my application, attributable to this function.
Thank you so much for your work maintaining this library! If I have more time soon I might return to the issue and attempt a fix.
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Sounds like a bug to me. I'm also not exactly familiar with the object lifecycle management in CoreFoundation, so I welcome your contrib (or someone else). If someone starts on it, let me know so I can assign the issue to you and avoid duplication of work.
is holding on to the exception at the global level forever. This exception keeps a reference to the current traceback, and that tracebacks keeps references to all the local variables up the stack.
Replacing import keyring.backends.Windows with keyring.get_password() reproduces the same behaviour, I assume it's doing a dynamic import internally.
I'm not suitably familiar with keyring to offer a PR, but hopefully this helps :)
Calling the
keyring.get_password()
function repeatedly on MacOS results in leaked memory. The problem appears to be in find_generic_password(), where the memory allocated bySecItemCopyMatching()
is never released. I spent some time trying to fix the issue, but it was dragging me further into the world of CoreFoundation internals than I had time to go.I don't know how serious the problem is in practice, but using memray I was seeing a non-negligible memory allocation (~30MB) hanging around in my application, attributable to this function.
Thank you so much for your work maintaining this library! If I have more time soon I might return to the issue and attempt a fix.
The text was updated successfully, but these errors were encountered: