Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9000#discussion_r41569596
--- Diff: core/src/main/scala/org/apache/spark/storage/MemoryStore.scala ---
@@ -507,16 +500,17 @@ private[spark] class MemoryStore(blockManager:
BlockManager, maxMemory: Long)
* Release memory used by this task for unrolling blocks.
* If the amount is not specified, remove the current task's allocation
altogether.
*/
- def releaseUnrollMemoryForThisTask(memory: Long = -1L): Unit = {
+ def releaseUnrollMemoryForThisTask(memory: Long = Long.MaxValue): Unit =
{
val taskAttemptId = currentTaskAttemptId()
accountingLock.synchronized {
- if (memory < 0) {
- unrollMemoryMap.remove(taskAttemptId)
- } else {
- unrollMemoryMap(taskAttemptId) =
unrollMemoryMap.getOrElse(taskAttemptId, memory) - memory
- // If this task claims no more unroll memory, release it completely
- if (unrollMemoryMap(taskAttemptId) <= 0) {
- unrollMemoryMap.remove(taskAttemptId)
+ if (unrollMemoryMap.contains(taskAttemptId)) {
+ val memoryToRelease = math.min(memory,
unrollMemoryMap(taskAttemptId))
+ if (memoryToRelease > 0) {
+ unrollMemoryMap(taskAttemptId) -= memoryToRelease
+ if (unrollMemoryMap(taskAttemptId) == 0) {
--- End diff --
Actually, I guess not since we never decrement by more than the current
value.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]