RFR: 8300117: Replace use of JNI_COMMIT mode with mode 0

Daniel Jeliński djelinski at openjdk.org
Tue Jan 17 08:14:48 UTC 2023


Please review this patch that fixes memory leaks in native code.

The call to `ReleaseXXArrayElements` with `JNI_COMMIT` parameter does not release the native buffer allocated by the previous `GetXXArrayElements` call. The buffer pointers were only stored in local variables and were lost on function exit.

No new regression test; existing tests under `java/awt/dnd` and `java/awt/datatransfer` cover all 3 modified functions.

Mach5 clientlibs tests continue to pass.

-------------

Commit messages:
 - Use mode = 0

Changes: https://git.openjdk.org/jdk/pull/12023/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12023&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8300117
  Stats: 5 lines in 2 files changed: 0 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/12023.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12023/head:pull/12023

PR: https://git.openjdk.org/jdk/pull/12023



More information about the client-libs-dev mailing list