HeartSaVioR commented on code in PR #46351: URL: https://github.com/apache/spark/pull/46351#discussion_r1589764171
########## sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/HDFSBackedStateStoreProvider.scala: ########## @@ -351,7 +351,7 @@ private[sql] class HDFSBackedStateStoreProvider extends StateStoreProvider with } override def close(): Unit = { - synchronized { loadedMaps.values.asScala.foreach(_.clear()) } + synchronized { loadedMaps.keySet().asScala.toSeq.foreach(loadedMaps.remove) } Review Comment: > so i think it just resets for the root and won't clear the values If we have belief of the implementation of GC then this shouldn't matter at all. the entry instance referenced by root is dereferenced, losing reference count, and will be GC-ed. cascading effect would apply to the whole tree and effectively all of them will be GC-ed. It might be still a best effort of freeing memory from these entries earlier, likewise we clear the value previously, but in theory they are semantically same. I'm OK with keeping best effort of it. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org