Fix excessive memory usage

* Fix excessive memory usage
* Remove output copy on GetLine()