-
Notifications
You must be signed in to change notification settings - Fork 19
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
Run Dart finalizer callback for external types when they fail to post #19
Conversation
Fix ZeroCopyBuffer memory leak related to discussion in shekohex#6
Hello @trueb2! Well, that sounds good, but did you also check out #7? I'm afraid without any proper unit tests here for that PR specifically, we could be doing double-free here. I actually totally forgot about #6 to continue diving in the dartvm code, but anyway, is there a way you can make a small test for this? |
Hi @shekohex, Thanks for supporting this project! I really appreciate the ability to integrate async Rust with Flutter. I ran the change for a couple days with real-world data and added calls to post before the store pointer is set, other than that I don't add more test cases. The current container tests already simulates the VM calling the finalizer. We could still mock a random failure into the post interface and assert success and failure appropriately. Failure to post or retry post could end up leaking expensive Dart allocations waiting for a message on the native port. I am thinking that the post function or another exposed function should block until success. I see cargo fmt touched several files. Do you want me to keep or remove those changes? |
Try |
To be honest I see this as a really rare case, where the post message fails, but of cource it exist and could happen. And for that I guess we leave it as is and it is up to the caller to check if returns |
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.
LGTM!
will publish a new beta version soon!
Fix ZeroCopyBuffer memory leak related to discussion in #6.
Even though this memory leak seems unlikely, there should be an attempt to handle failure to post