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

ffi:Pointer finalizer #53

Closed
Buggaboo opened this issue Oct 24, 2019 · 7 comments · Fixed by #240
Closed

ffi:Pointer finalizer #53

Buggaboo opened this issue Oct 24, 2019 · 7 comments · Fixed by #240
Labels
enhancement New feature or request
Milestone

Comments

@Buggaboo
Copy link
Contributor

Buggaboo commented Oct 24, 2019

We should track the development of this issue.
It might be available on the bleeding edge dart.

@Buggaboo Buggaboo changed the title Pointer type finalizer ffi:Pointer type finalizer Oct 24, 2019
@Buggaboo Buggaboo changed the title ffi:Pointer type finalizer ffi:Pointer finalizer Oct 24, 2019
@vaind vaind added the enhancement New feature or request label Oct 25, 2019
@Sunbreak
Copy link

dart-lang/sdk#35770 (comment)

dart:ffi supports GC finalizers now!

@vaind
Copy link
Contributor

vaind commented Jun 29, 2020

Good to hear, let's see in what form it actually lands in Dart. There are some open issues still.

@vaind
Copy link
Contributor

vaind commented Mar 11, 2021

The way this can be used already doesn't look so bad. If we could temporarily have a single obx_dart_register_finalizer(void*, obx_*_close() pointer) in the native API, that wouldn't be the worst thing in the world I guess...

That way we could get rid of all the close() calls already for 1.0. Later, when finalizers land in user-land dart, we can implement them properly and drop the native function. 🤔

@vaind vaind added this to the 1.0 milestone Mar 11, 2021
@Buggaboo
Copy link
Contributor Author

Buggaboo commented Apr 29, 2021

Structs / Pointers are disallowed finalizers, due to potential use-after-freeing memory. It can still be used indirectly, I hope, by maintaing a memory address pool.

@vaind
Copy link
Contributor

vaind commented May 4, 2021

I guess we're gonna wait how this turns out. With pointers out of the question, we wouldn't be able to use finalizers for what we need them.

@vaind vaind removed this from the 1.0 milestone May 4, 2021
@vaind vaind added the on-hold Blocked by some other issue or a lack of information/ideas how to proceed. label May 4, 2021
@vaind
Copy link
Contributor

vaind commented May 12, 2021

Another follow-up issue in dart SDK: https://github.com/dart-lang/sdk/issues/45455

@vaind vaind added this to the 1.0 milestone May 13, 2021
@vaind
Copy link
Contributor

vaind commented May 13, 2021

I've ended up implementing this using the currently available finalizers and it works fine.

@vaind vaind removed the on-hold Blocked by some other issue or a lack of information/ideas how to proceed. label May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants