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

dart/ffi: automatic release of pointers #39748

Closed
derolf opened this issue Dec 11, 2019 · 1 comment
Closed

dart/ffi: automatic release of pointers #39748

derolf opened this issue Dec 11, 2019 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-ffi

Comments

@derolf
Copy link

derolf commented Dec 11, 2019

Right how, pointers returned from FFI functions require manual reference counting on the dart level.

Provide a way to automatically clean up native references once they are not referenced anymore.

@vsmenon vsmenon added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-ffi labels Dec 11, 2019
@dcharkes
Copy link
Contributor

That can potentially be achieved in two ways:

  • pool allocation: clean up when end of scope (like try-with-resources in Java or using in C#)
  • finalizers: clean up when garbage collector collects pointer object

Pool allocation is tracked in dart-archive/ffi#30. We would like to add the pool to package:ffi soon, please leave your feedback on that issue.

Finalizers is tracked in #35770. This will take longer to implement.

I'll close this issue as a duplicate of either one of the above two. Feel free to reopen if you have questions related which are not pool or finalizer related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-ffi
Projects
None yet
Development

No branches or pull requests

3 participants