Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Memory leak in java directors when passing byte arrays (char*, size_t)
When passing a byte array from c++ to Java using the director feature, the generated jni code does not release a temporary byte array. This is the typemap specified in Java.swg: %typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) { jbyteArray jb = (jenv)->NewByteArray($2); (jenv)->SetByteArrayRegion(jb, 0, $2, (jbyte *)$1); $input = jb; } %typemap(directorargout) (char *STRING, size_t LENGTH) %{(jenv)->GetByteArrayRegion($input, 0, $2, (jbyte *)$1); %} Notice that the call to NewByteArray doesn't contain a symmetric release logic as the SetByteArrayRegion/GetByteArrayRegion does. Closes swig#386
- Loading branch information