Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use _elementsRead
  • Loading branch information
cxzl25 committed Jun 26, 2025
commit 8374d18f7aab6017626fd3563b4c4e930a0c9d84
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private[spark] abstract class Spillable[C](taskMemoryManager: TaskMemoryManager)
if (_elementsRead > numElementsForceSpillThreshold
|| currentMemory > maxSizeForceSpillThreshold) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By moving _elementsRead > numElementsForceSpillThreshold here, we would actually reduce some unnecessary allocations .... nice !

shouldSpill = true
} else if (elementsRead % 32 == 0 && currentMemory >= myMemoryThreshold) {
} else if (_elementsRead % 32 == 0 && currentMemory >= myMemoryThreshold) {
// Claim up to double our current memory from the shuffle memory pool
val amountToRequest = 2 * currentMemory - myMemoryThreshold
val granted = acquireMemory(amountToRequest)
Expand All @@ -101,7 +101,7 @@ private[spark] abstract class Spillable[C](taskMemoryManager: TaskMemoryManager)
// Actually spill
if (shouldSpill) {
_spillCount += 1
logSpillage(currentMemory, elementsRead)
logSpillage(currentMemory, _elementsRead)
spill(collection)
_elementsRead = 0
_memoryBytesSpilled += currentMemory
Expand Down