zhli1142015 commented on a change in pull request #28769:
URL: https://github.com/apache/spark/pull/28769#discussion_r439159094
##########
File path:
common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDBIterator.java
##########
@@ -189,17 +189,7 @@ public synchronized void close() throws IOException {
it.close();
closed = true;
}
- }
-
- /**
- * Because it's tricky to expose closeable iterators through many internal
APIs, especially
- * when Scala wrappers are used, this makes sure that, hopefully, the JNI
resources held by
- * the iterator will eventually be released.
- */
- @SuppressWarnings("deprecation")
- @Override
- protected void finalize() throws Throwable {
Review comment:
@srowen , thanks for comments. i realized `finalize` may not work as we
expected, as `LevelDBIterator` objects are referenced in `LevelDB` till it's
closed. You are right, it can help with leak. i updated PR to track
`DBIterator` instead of `LevelDBIterator` in `LevelDB`, then function
`finalize` can still works as before.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]