[JNIgen] Context param for interface implementation
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
Because the Dart and Java GCs do not know about each other, we can end up in situations where we lose reference in the Dart to a Dart object A and lose reference in Java to a Java object B, but B holds on to A via a (for example via an open port if A is a closure) and A holds on to B via a JObject.
It is not clear if this issue is going to be very common, but we should keep an eye on it: We should document any patterns that we find that might result in this. Probably we can construct one with https://github.com/dart-lang/jnigen/pull/369.
If it's common we should probably provide some kind of weak reference system in at least one direction. It might depend per use case if this is possible.
(A completely out of scope, but conceptually cool, solution: A unified Dart and Java heap in the style of Oilpan which unifies the C++ DOM heap with the JS heap: https://v8.dev/blog/oilpan-library)
Contributor guide
Assessment
This issue has not been assessed yet.