Skip to content

Commit 1adeb87

Browse files
committed
Add an API to forget the shared JavaVirtualMachine instance
1 parent 2fe5c03 commit 1adeb87

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/JavaKitVM/JavaVirtualMachine.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ extension JavaVirtualMachine {
226226
}
227227
}
228228
}
229+
230+
/// "Forget" the shared JavaVirtualMachine instance.
231+
///
232+
/// This will allow the shared JavaVirtualMachine instance to be deallocated.
233+
public static func forgetShared() {
234+
sharedJVM.withLock { sharedJVMPointer in
235+
sharedJVMPointer = nil
236+
}
237+
}
229238
}
230239

231240
extension JavaVirtualMachine {

0 commit comments

Comments
 (0)