Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/6859#issuecomment-113009914
  
    @srowen @andrewor14 Yes, this can not reduce the memory usage. But it is 
intended to avoid the out-of-memory problem caused by `StringBuilder` when it 
expands its capacity during the continuous appending strings.
    
    In fact, `mkString` is also implemented with `StringBuilder` internally. So 
for the iteratively appending strings, this PR still uses `StringBuilder` to 
achieve it. The difference is that this fixing separates one single 
`StringBuilder` appending chain.
    
    I just found because it calls `map` to produce many strings before 
`mkString` , it would waste much memory. I should use another `StringBuilder` 
to do that. I will update later and please see if it is better.


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