Skip to content
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

RustFuture: fix memory leak #2056

Merged
merged 1 commit into from
Apr 3, 2024
Merged

RustFuture: fix memory leak #2056

merged 1 commit into from
Apr 3, 2024

Conversation

QuentinPerez
Copy link
Contributor

Currently, rust_future_free doesn't properly release memory, leading to a memory leak. This happens because get_arc increases the reference count of RustFuture without decreasing it afterward. By using consume_handle we do not increase it anymore before giving the ownership to ffi_free.

I have tested this fix in my project and confirmed that it resolves the memory leak. Let me know if I missed something.

@QuentinPerez QuentinPerez requested a review from a team as a code owner March 30, 2024 12:08
@QuentinPerez QuentinPerez requested review from jeddai and removed request for a team March 30, 2024 12:08
@QuentinPerez QuentinPerez mentioned this pull request Apr 3, 2024
@mhammond mhammond requested a review from bendk April 3, 2024 17:40
@mhammond
Copy link
Member

mhammond commented Apr 3, 2024

closing and reopening to try and convince CI to run.

@mhammond mhammond closed this Apr 3, 2024
@mhammond mhammond reopened this Apr 3, 2024
Copy link
Contributor

@bendk bendk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks correct to me and all the tests are passing. I think it should go into 0.27.1.

I'm not sure what's up with the Circle CI error, but it seems like the tests are passing and they also pass when I run them locally.

@bendk bendk merged commit 258a24e into mozilla:main Apr 3, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants