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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly free some Rust-side objects #3911
Conversation
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.
This seems like a really awful footgun, if we wanted the malloc life we wouldn't have been TS devs - is there any way around this on the horizon?
Suggestions welcome! |
I know almost nothing about Rust, and absolutely nothing about incorporating Rust in Javascript. Equally though if switching to rust crypto means brittle as hell code I think I'm no longer in favour |
with the greatest respect, I feel like "should we adopt the Rust cryptography library in Element Web" is a discussion that is out of the scope of this PR. |
No arguing that |
Finalization in Javascript is not guaranteed - sometimes the FinalizationRegistry just forgets to call the finalizers on some objects. This is problematic because it means we leak references on the Rust side, which (as well as causing memory leaks) ultimately leads to us holding open the indexeddb, which then means we can't successfully log in/out.
This isn't meant to be a comprehensive fix, but it does add explicit
free
calls in a number of places which seem particularly prone to leaking, and empirically it was enough for me to get a Cypress test which logs out and back in working again.Here's what your changelog entry will look like:
馃悰 Bug Fixes