mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-25 01:02:20 -04:00
In async functions, the Node.js GC may or may not (that's a random behavior) collect the arguments passed to the function as soon as it returns. The function may not be executed yet, since it's async. Thus, it leads to memory corruption: The function tries to read later on the value inside an argument and… it crashes at best. To avoid this bug, there is no other choice than cloning the values before the function returns, in its “sync path” (so before any transformation of an `.await` point into an “async block”). The performance impact is not “massive”, I'm not sure it could be noticeable easily since it is most of the time related to identifiers (e.g. `UserId`), which are cheap to clone. I have to find the balance here, and cloning offers the best trade off from my point of view.
Matrix Rust SDK bindings
In this directory, one can find bindings to the Rust SDK that are maintained by the owners of the Matrix Rust SDK project.
appleormatrix-rust-components-swift, Swift bindings of thematrix-sdkcrate viamatrix-sdk-ffi,matrix-sdk-crypto-ffi, bindings of thematrix-sdk-cryptocrate,matrix-sdk-crypto-js, JavaScript bindings of thematrix-sdk-cryptocrate,matrix-sdk-crypto-nodejs, Node.js bindings of thematrix-sdk-cryptocrate,matrix-sdk-ffi, bindings of thematrix-sdkcrate,