You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2013/09/26 20:27:46 UTC

[2/4] git commit: Set currentMemory to 0 in clear(). Remove unnecessary entries.get() call.

Set currentMemory to 0 in clear().
Remove unnecessary entries.get() call.


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

Branch: refs/heads/master
Commit: d34672f6684d2c14fc5db58335370ef9ba84375e
Parents: 293c758
Author: Mike <wa...@users.noreply.github.com>
Authored: Wed Sep 11 18:01:19 2013 -0700
Committer: Mike <wa...@users.noreply.github.com>
Committed: Wed Sep 11 18:01:19 2013 -0700

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/storage/MemoryStore.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/d34672f6/core/src/main/scala/org/apache/spark/storage/MemoryStore.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/storage/MemoryStore.scala b/core/src/main/scala/org/apache/spark/storage/MemoryStore.scala
index c465a9a..4344f85 100644
--- a/core/src/main/scala/org/apache/spark/storage/MemoryStore.scala
+++ b/core/src/main/scala/org/apache/spark/storage/MemoryStore.scala
@@ -110,9 +110,8 @@ private class MemoryStore(blockManager: BlockManager, maxMemory: Long)
 
   override def remove(blockId: String): Boolean = {
     entries.synchronized {
-      val entry = entries.get(blockId)
+      val entry = entries.remove(blockId)
       if (entry != null) {
-        entries.remove(blockId)
         currentMemory -= entry.size
         logInfo("Block %s of size %d dropped from memory (free %d)".format(
           blockId, entry.size, freeMemory))
@@ -126,6 +125,7 @@ private class MemoryStore(blockManager: BlockManager, maxMemory: Long)
   override def clear() {
     entries.synchronized {
       entries.clear()
+      currentMemory = 0
     }
     logInfo("MemoryStore cleared")
   }