Repository: spark
Updated Branches:
  refs/heads/branch-1.1 267c7be3b -> 553183024


[SPARK-3731] [PySpark] fix memory leak in PythonRDD

The parent.getOrCompute() of PythonRDD is executed in a separated thread, it 
should release the memory reserved for shuffle and unrolling finally.

Author: Davies Liu <[email protected]>

Closes #2668 from davies/leak and squashes the following commits:

ae98be2 [Davies Liu] fix memory leak in PythonRDD

(cherry picked from commit bc87cc410fae59660c13b6ae1c14204df77237b8)
Signed-off-by: Josh Rosen <[email protected]>

Conflicts:
        core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/55318302
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/55318302
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/55318302

Branch: refs/heads/branch-1.1
Commit: 5531830246dd3ee9e1feed96ec565c7405ee8b95
Parents: 267c7be
Author: Davies Liu <[email protected]>
Authored: Tue Oct 7 12:20:12 2014 -0700
Committer: Josh Rosen <[email protected]>
Committed: Tue Oct 7 13:05:29 2014 -0700

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/55318302/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala 
b/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
index 7470238..2d41502 100644
--- a/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
+++ b/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
@@ -218,6 +218,10 @@ private[spark] class PythonRDD(
           _exception = e
       } finally {
         Try(worker.shutdownOutput()) // kill Python worker process
+        // Release memory used by this thread for shuffles
+        env.shuffleMemoryManager.releaseMemoryForThisThread()
+        // Release memory used by this thread for unrolling blocks
+        env.blockManager.memoryStore.releaseUnrollMemoryForThisThread()
       }
     }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to