Skip to content

Conversation

@ktoso
Copy link
Collaborator

@ktoso ktoso commented Oct 29, 2024

This implements SwiftArena.ofAuto() which uses phantom references (and a Cleaner) to manage java swift wrapper classes on the java side.

Usage is something like this:

new SwiftClass(SwiftArena.ofAuto())

When the JVM no longer has references to such object, it will initiate the clean of the object. Currently this is going to destroy() the object, however in this mode we should perhaps just decrement the reference count of the underlying object for swift classes, unlike in the Confined case.

@ktoso ktoso merged commit d1e4b8f into swiftlang:main Oct 29, 2024
11 checks passed
@ktoso ktoso deleted the wip-auto-arena branch October 29, 2024 02:57
ktoso added a commit to ktoso/swift-java that referenced this pull request Oct 30, 2024
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.

1 participant