Github user lianhuiwang commented on a diff in the pull request:
https://github.com/apache/spark/pull/10024#discussion_r60540340
--- Diff:
core/src/main/scala/org/apache/spark/util/collection/Spillable.scala ---
@@ -100,6 +103,27 @@ private[spark] trait Spillable[C] extends Logging {
}
/**
+ * Spill some data to disk to release memory, which will be called by
TaskMemoryManager
+ * when there is not enough memory for the task.
+ */
+ override def spill(size: Long, trigger: MemoryConsumer): Long = {
+ if (trigger != this && taskMemoryManager.getTungstenMemoryMode ==
MemoryMode.ON_HEAP) {
+ val isSpilled = forceSpill()
+ if (!isSpilled) {
+ 0L
+ } else {
+ _elementsRead = 0
+ val freeMemory = myMemoryThreshold - initialMemoryThreshold
+ _memoryBytesSpilled += freeMemory
+ releaseMemory()
+ freeMemory
--- End diff --
It did collection = null in forceSpill() before releaseMemory().
---
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]