Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6859#discussion_r32694593
  
    --- Diff: 
core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala ---
    @@ -165,12 +165,12 @@ private[ui] object RDDOperationGraph extends Logging {
        * For the complete DOT specification, see 
http://www.graphviz.org/Documentation/dotguide.pdf.
        */
       def makeDotFile(graph: RDDOperationGraph): String = {
    -    val dotFile = new StringBuilder
    -    dotFile.append("digraph G {\n")
    -    dotFile.append(makeDotSubgraph(graph.rootCluster, indent = "  "))
    -    graph.edges.foreach { edge => dotFile.append(s"""  
${edge.fromId}->${edge.toId};\n""") }
    -    dotFile.append("}")
    -    val result = dotFile.toString()
    +    val subgraph = makeDotSubgraph(graph.rootCluster, indent = "  ")
    +
    +    val edges = new StringBuilder
    --- End diff --
    
    We don't want to use a single `StringBuilder` to concatenate all strings 
here. When  the `StringBuilder` appended the string of `makeDotSubgraph`, it 
may already contain a long string. If `graph.edges` has too many appending 
operations and it exceeds the `StringBuilder`'s capacity, `StringBuilder` will 
expands its capacity and ask twice memory. It can easily cause out-of-memory 
problem.


---
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]

Reply via email to