Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/3629#discussion_r25046107
--- Diff: core/src/main/scala/org/apache/spark/storage/MemoryStore.scala ---
@@ -283,12 +284,13 @@ private[spark] class MemoryStore(blockManager:
BlockManager, maxMemory: Long)
}
} finally {
- // If we return an array, the values returned do not depend on the
underlying vector and
- // we can immediately free up space for other threads. Otherwise, if
we return an iterator,
+ // If we return an array, the values returned will be used in
tryToPut()
+ // and finally put into memoryStore.entrys, so we pending unroll
memory
+ // for this thread and release it in tryToPut(). Otherwise, if we
return an iterator,
// we release the memory claimed by this thread later on when the
task finishes.
if (keepUnrolling) {
val amountToRelease = currentUnrollMemoryForThisThread -
previousMemoryReserved
- releaseUnrollMemoryForThisThread(amountToRelease)
+ releaseUnrollMemoryForThisThread(amountToRelease, true)
--- End diff --
Instead of introducing a random boolean flag here, I would just move the
acquire pending memory code into `unrollSafely`:
```
if (keepUnrolling) {
val amountToRelease = currentUnrollMemoryForThisThread -
previousMemoryReserved
releaseUnrollMemoryForThisThread(amountToRelease)
reservePendingUnrollMemoryForThisThread(amountToRelease)
}
```
then somewhere down there you'll have to define
`reservePendingUnrollMemoryForThisThread`
---
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]