Recently, we've been attempting to upgrade our TileDB-Java usage from 0.10.1 to 0.17.8. When upgrading we noticed that the previous subarray functionality which used NativeBuffer instances with slicing Java primitive arrays has been replaced with a SubArray class which has many more features. Since in our usage we perform many 10s of thousands of subarray reads and writes we're pretty pedantic about cleaning up the native memory sitting behind the JNI bindings so call close() in try-with-resources blocks throughout our codebase.
When doing this on SubArray instances we noticed that the parent Array was being closed immediately:
It looks like this was added in #251. I'm not sure this was intended as this code appears to be hand rolled? If this was, could someone explain how to properly free the SubArray native resources without closing the array? It would also be nice if this close() method did not declare to be throwing a checked Exception. This appears unneeded and is also not consistent with many of the other close() methods across the codebase.
Hope everyone from the TileDB team is well!
Recently, we've been attempting to upgrade our TileDB-Java usage from 0.10.1 to 0.17.8. When upgrading we noticed that the previous subarray functionality which used
NativeBuffer
instances with slicing Java primitive arrays has been replaced with aSubArray
class which has many more features. Since in our usage we perform many 10s of thousands of subarray reads and writes we're pretty pedantic about cleaning up the native memory sitting behind the JNI bindings so callclose()
in try-with-resources blocks throughout our codebase.When doing this on
SubArray
instances we noticed that the parentArray
was being closed immediately:https://github.com/TileDB-Inc/TileDB-Java/blob/master/src/main/java/io/tiledb/java/api/SubArray.java#L806-L808
It looks like this was added in #251. I'm not sure this was intended as this code appears to be hand rolled? If this was, could someone explain how to properly free the SubArray native resources without closing the array? It would also be nice if this
close()
method did not declare to be throwing a checkedException
. This appears unneeded and is also not consistent with many of the otherclose()
methods across the codebase.