You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/22 20:24:48 UTC

[GitHub] [spark] kevins-29 commented on a change in pull request #35613: [SPARK-38273][SQL] Fix native memory leak in SparkPlan when spark.io.compression.codec=zstd

kevins-29 commented on a change in pull request #35613:
URL: https://github.com/apache/spark/pull/35613#discussion_r812327795



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlan.scala
##########
@@ -384,17 +385,34 @@ abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializ
     val bis = new ByteArrayInputStream(bytes)
     val ins = new DataInputStream(codec.compressedInputStream(bis))
 
-    new Iterator[InternalRow] {
+    new NextIterator[InternalRow] {
+      private val taskContext: TaskContext = TaskContext.get()
+      if (taskContext != null) {
+        taskContext.addTaskCompletionListener[Unit] { _ => closeIfNeeded() }
+      }

Review comment:
       The `closeIfNeeded()` method is a member of NextIterator.




-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org