Github user tgravescs commented on a diff in the pull request: https://github.com/apache/spark/pull/14673#discussion_r75128458 --- Diff: core/src/main/scala/org/apache/spark/ui/jobs/JobProgressListener.scala --- @@ -137,6 +139,17 @@ class JobProgressListener(conf: SparkConf) extends SparkListener with Logging { ) } + /** If Tasks is too large, remove and garbage collect old tasks */ + private def trimTasksIfNecessary(taskData: HashMap[Long, TaskUIData]) = synchronized { + if (taskData.size > retainedTasks) { + val toRemove = (taskData.size - retainedTasks) + val oldIds = taskData.map(_._2.taskInfo.taskId).toList.sorted.take(toRemove) --- End diff -- is there a reason we are using _._2.taskInfo.taskId instead of just the Long ( _._1), which is the taskId also? I'm a bit concerned with the sorting here. If someone is using really large number of tasks , say 1 million I'm afraid this sorting might be expensive, especially if we are doing it for every single task that comes in after hitting the limit, we have to keep resorting every time.
--- 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