GoString doesn't release java characters #13

Closed
opened 2025-12-30 19:38:55 +05:30 by whereswaldon · 0 comments
Contributor

The implementation here does not release the JNI characters after converting them to Go, which leaks the object on the JVM side.

We can see that in the spec the returned character buffer is valid until a call to ReleaseStringChars.

The implementation [here](https://git.wow.st/gmp/jni/src/commit/34026c7e22d0/jni.go#L408) does not release the JNI characters after converting them to Go, which leaks the object on the JVM side. We can see that in the [spec](https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringchars) the returned character buffer is valid until a call to [ReleaseStringChars](https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releasestringchars).
gmp closed this issue 2026-08-21 08:38:38 +05:30
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gmp/jni#13