Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/11874#discussion_r57094823
--- Diff:
core/src/main/scala/org/apache/spark/memory/StorageMemoryPool.scala ---
@@ -56,11 +56,13 @@ private[memory] class StorageMemoryPool(lock: Object)
extends MemoryPool(lock) w
/**
* Acquire N bytes of memory to cache the given block, evicting existing
ones if necessary.
- *
+ *
* @return whether all N bytes were successfully granted.
*/
- def acquireMemory(blockId: BlockId, numBytes: Long): Boolean =
lock.synchronized {
- val numBytesToFree = math.max(0, numBytes - memoryFree)
+ def acquireMemory(blockId: BlockId, numBytes: Long): Boolean = {
+ val numBytesToFree = lock.synchronized {
+ math.max(0, numBytes - memoryFree)
+ }
acquireMemory(blockId, numBytes, numBytesToFree)
--- End diff --
I just pushed a patch which aims to address (1). I don't think that (2) is
a concern because we're only missing out on an opportunity which did not exist
prior to this patch's changes. In the old code, other tasks' calls to free
storage memory would be blocked due to contention on the MemoryManager lock, so
this transaction wouldn't observe the effect of free()s which took place after
it started.
---
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]