liuzqt commented on code in PR #47192: URL: https://github.com/apache/spark/pull/47192#discussion_r1667111116
########## core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java: ########## @@ -507,4 +525,19 @@ public long getMemoryConsumptionForThisTask() { public MemoryMode getTungstenMemoryMode() { return tungstenMemoryMode; } + + /** + * Returns peak task-level off-heap memory usage in bytes. + * + */ + public long getPeakOnHeapExecutionMemory() { + return peakOnHeapMemory; + } Review Comment: So far I think it's safe, as you mentioned, only invoked at the end of task. But no harm to add `volatile`, in case we might have race condition in the future if we add other use case. ########## core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala: ########## @@ -111,8 +113,14 @@ class TaskMetrics private[spark] () extends Serializable { * across all such data structures created in this task. For SQL jobs, this only tracks all * unsafe operators and ExternalSort. */ + // TODO: SPARK-48789: the naming is confusing since this does not really reflect the whole Review Comment: Updated -- 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