Github user JeetKunDoug commented on a diff in the pull request:
https://github.com/apache/spark/pull/21322#discussion_r189276054
--- Diff:
core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala ---
@@ -384,14 +385,37 @@ private[spark] class MemoryStore(
}
}
+ private def maybeReleaseResources(entry: MemoryEntry[_]): Unit = {
+ entry match {
+ case SerializedMemoryEntry(buffer, _, _) => buffer.dispose()
+ case DeserializedMemoryEntry(values: Array[Any], _, _) =>
maybeCloseValues(values)
+ case _ =>
+ }
+ }
+
+ private def maybeCloseValues(values: Array[Any]): Unit = {
+ values.foreach {
+ case closable: AutoCloseable =>
+ safelyCloseValue(closable)
+ case _ =>
+ }
+ }
+
+ private def safelyCloseValue(closable: AutoCloseable): Unit = {
+ try {
+ closable.close()
+ } catch {
+ case ex: Exception => logWarning(s"Failed to close AutoClosable
$closable", ex)
+ }
+ }
+
def remove(blockId: BlockId): Boolean = memoryManager.synchronized {
val entry = entries.synchronized {
entries.remove(blockId)
}
if (entry != null) {
- entry match {
- case SerializedMemoryEntry(buffer, _, _) => buffer.dispose()
- case _ =>
+ if (blockId.isBroadcast) {
+ maybeReleaseResources(entry)
--- End diff --
@dbtsai thanks - That whole "my day job vs. OSS" rush to fix. Will take
care of it correctly and push an update.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]