-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix memory leak between the RLBot library and rlbot-rust #29
Conversation
It is possible to have Physics in a PredictionSlice where Rotator is a None value. In this case just return the default (zero) value instead.
Would it be possible to copy the flatbuffer data into a vector that is owned by the wrapper? It should then be possible to immediately free the original buffer so you don't have to carry around a reference to |
Nice! |
BREAKING CHANGE
Fixes #25 a memory leak where the byte buffer passed from the RLBot interface library was never freed. This requires quite drastic internal change to how serialized flatbuffers are handled. Because it is now required to deserialize into our own types, this will break existing Rust bots.
Concerns
src/game.rs
src/ffi.rs
andsrc/rlbot_generated.rs
)I'm also open to rewriting this with a flatbuffer wrapper type that Deref's to the underlying flatbuffer type. I discarded this solution, because it means the wrapper has to carry around a reference to
RLBotCoreInterface::free()
. Overall, the current solution seems cleaner, at the expense of an allocation and a copy.