[foreign-abi] Integrated: 8254682: Close MemorySegments passed to upcalls after the upcall is done
Jorn Vernee
jvernee at openjdk.java.net
Tue Oct 13 17:43:22 UTC 2020
On Tue, 13 Oct 2020 14:58:29 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> Hi,
>
> Currently, we don't close MemorySegments that we pass to upcalls. This makes it easier to leak a MemorySegment from an
> upcall, but it also incurs an additional copy on Windows and Aarch64, and forces users to close these segments manually
> instead. (This is mostly so for historical reasons, when it was not as easy to avoid this copy due to the code
> structure/design at that time). We can instead registers these segments with a NativeScope that is closed after the
> upcall completes, to make sure these segments do not leak inadvertently, and we don't need the additional copy on some
> platforms. In this PR I've also fixed 2 minor Javadoc issues in Binding.java that I missed last time around.
> This patch will also break jexract tests, but I have a patch ready to fix (was pretty trivial).
> (https://github.com/openjdk/panama-foreign/pull/380)
> Thanks,
> Jorn
This pull request has now been integrated.
Changeset: 76b9a24e
Author: Jorn Vernee <jvernee at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/76b9a24e
Stats: 282 lines in 11 files changed: 228 ins; 28 del; 26 mod
8254682: Close MemorySegments passed to upcalls after the upcall is done
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/379
More information about the panama-dev
mailing list