-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-21090][core]Optimize the unified memory manager code #18296
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,7 +160,7 @@ private[spark] class UnifiedMemoryManager private[memory] ( | |
case MemoryMode.OFF_HEAP => ( | ||
offHeapExecutionMemoryPool, | ||
offHeapStorageMemoryPool, | ||
maxOffHeapMemory) | ||
maxOffHeapStorageMemory) | ||
} | ||
if (numBytes > maxMemory) { | ||
// Fail fast if the block simply won't fit | ||
|
@@ -171,7 +171,8 @@ private[spark] class UnifiedMemoryManager private[memory] ( | |
if (numBytes > storagePool.memoryFree) { | ||
// There is not enough free memory in the storage pool, so try to borrow free memory from | ||
// the execution pool. | ||
val memoryBorrowedFromExecution = Math.min(executionPool.memoryFree, numBytes) | ||
val memoryBorrowedFromExecution = Math.min(executionPool.memoryFree, | ||
numBytes - storagePool.memoryFree) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change makes sense: if we hit this branch then we've failed to acquire enough memory to store a block. In particular, we might need |
||
executionPool.decrementPoolSize(memoryBorrowedFromExecution) | ||
storagePool.incrementPoolSize(memoryBorrowedFromExecution) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a bug in the old code. Good catch.