Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/21322#discussion_r224874828
--- Diff:
core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala ---
@@ -384,15 +385,30 @@ private[spark] class MemoryStore(
}
}
+ private def maybeReleaseResources(resource: (BlockId, MemoryEntry[_])):
Unit = {
+ maybeReleaseResources(resource._1, resource._2)
+ }
+
+ private def maybeReleaseResources(blockId: BlockId, entry:
MemoryEntry[_]): Unit = {
+ entry match {
+ case SerializedMemoryEntry(buffer, _, _) => buffer.dispose()
+ case DeserializedMemoryEntry(values: Array[Any], _, _) =>
maybeCloseValues(values, blockId)
+ case _ =>
+ }
+ }
+
+ private def maybeCloseValues(values: Array[Any], blockId: BlockId): Unit
= {
+ if (blockId.isBroadcast) {
+ values.foreach(value => Utils.tryClose(value))
--- End diff --
Just a style thing, but could be `values.foreach(Utils.tryClose)`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]