Normally, java code can use `finalize()` to release memory allocation in native code.