Skip to content

Conversation

@abhi951990
Copy link
Contributor

What changes were proposed in this pull request?

Removed the DeadCode as suggested.

Issue number SPARK-15045.
Removed Dead-code.
consumers.clear();
}

for (MemoryBlock page : pageTable) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear this code should be removed, though I agree right now it appears to be dead code because of line 382. CC @JoshRosen since I think you added this block? should line 382 just be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davies in L382 we null out the pageTable so this loop doesn't do anything. However, I don't think we should delete this code. Should we just remove L382? Is this a cause for memory leaks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted with @JoshRosen , these lines are introduce by logical conflict, it could be rewritten as

    synchronized (this) {
      for (MemoryConsumer c: consumers) {
        if (c != null && c.getUsed() > 0) {
          // In case of failed task, it's normal to see leaked memory
          logger.warn("leak " + Utils.bytesToString(c.getUsed()) + " memory from " + c);
        }
      }
      consumers.clear();

      for (MemoryBlock page : pageTable) {
        if (page != null) {
          logger.warn("leak a page: " + page + " in task " + taskAttemptId);
          memoryManager.tungstenMemoryAllocator().free(page);
        }
      }
      Arrays.fill(pageTable, null);
    }

Copy link
Contributor

@andrewor14 andrewor14 May 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that LGTM. @abhi951990 can you update this patch to reflect that?

@HyukjinKwon
Copy link
Member

@abhi951990 I think maybe it would be nicer if the title is more specific just like the title of this JIRA ticket. I think it would be even nicer if the title follows the format like others such as [SPARK-15045][CORE] XXXX (See https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark)

@abhi951990 abhi951990 changed the title [SPARK-15045] Update TaskMemoryManager.java [SPARK-15045] [CORE] Remove dead code in TaskMemoryManager.cleanUpAllAllocatedMemory for pageTable May 2, 2016
@andrewor14
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented May 4, 2016

Test build #57700 has finished for PR 12829 at commit 06be5e9.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@andrewor14
Copy link
Contributor

@abhi951990 I don't think this is dead code. It seems to be a potential bug.

@abhi951990
Copy link
Contributor Author

@andrewor14 So should I only delete line 382? Or should I leave as it is?

@andrewor14
Copy link
Contributor

Let's see what @davies thinks.

@SparkQA
Copy link

SparkQA commented May 5, 2016

Test build #57835 has finished for PR 12829 at commit ad748dd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@davies
Copy link
Contributor

davies commented May 5, 2016

LGTM, merging into master, thanks!

@asfgit asfgit closed this in 1a5c6fc May 5, 2016
asfgit pushed a commit that referenced this pull request May 5, 2016
…AllocatedMemory for pageTable

## What changes were proposed in this pull request?

Removed the DeadCode as suggested.

Author: Abhinav Gupta <[email protected]>

Closes #12829 from abhi951990/master.

(cherry picked from commit 1a5c6fc)
Signed-off-by: Davies Liu <[email protected]>
zzcclp added a commit to zzcclp/spark that referenced this pull request May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants