liuzqt commented on code in PR #47192:
URL: https://github.com/apache/spark/pull/47192#discussion_r1692144786


##########
core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala:
##########
@@ -110,9 +112,22 @@ class TaskMetrics private[spark] () extends Serializable {
    * joins. The value of this accumulator should be approximately the sum of 
the peak sizes
    * across all such data structures created in this task. For SQL jobs, this 
only tracks all
    * unsafe operators and ExternalSort.
+   * This is not equal to peakOnHeapExecutionMemory + 
peakOffHeapExecutionMemory
    */
+  // TODO: SPARK-48789: the naming is confusing since this does not really 
reflect the whole
+  //  execution memory. We'd better deprecate this once we have a replacement.
   def peakExecutionMemory: Long = _peakExecutionMemory.sum
 
+  /**
+   * Peak on heap execution memory as tracked by TaskMemoryManager.
+   */
+  def peakOnHeapExecutionMemory: Long = _peakOnHeapExecutionMemory.sum
+
+  /**
+   * Peak off heap execution memory as tracked by TaskMemoryManager.
+   */
+  def peakOffHeapExecutionMemory: Long = _peakOffHeapExecutionMemory.sum

Review Comment:
   peakExecutionMemory <= peakOnHeapExecutionMemory + 
peakOffHeapExecutionMemory?
   
   I think yes, because`TaskMemoryManager.acquireExecutionMemory` is the only 
narrow waist for any execution memory acquisition and we maintain the memory 
here.
   
   Instead, the legacy `peakExecutionMemory` is maintained in some operators 
(join, agg, sort), which is totally up to operator implementation.
   



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

Reply via email to