release memory in jni