GoString doesn't release java characters #13

Open
opened 2025-12-30 09:08:55 -05:00 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).
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gmp/jni#13
No description provided.