Github user WeichenXu123 commented on the issue: https://github.com/apache/spark/pull/14333 @srowen The sparkContext, by default, will running a cleaner to release not referenced RDD/broadcasts on background. But, I think, we'd better to release them by ourselves because the SparkContext auto-cleaner depends on java-gc. If gc not triggered the cleaner won't release the unused broadcasts. As we can see, if a driver-side broadcast has been unpersisted but not destroyed, its metadata will be keep in the context and the content of the var broadcasted is kept in driver-side, here in KMeans `bcNewCenters` is a two-dimension array so I think it is better to release them as soon as possible. About the overhead, I think to track these history `bcNewCenters` broadcasts only need a reference list and it can destroyed in async way so the overhead is acceptable.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org