scala/scala — pull request #4061 by maxcom (2014-10-17 19:28:37+00:00)
Title: SI-8924 don't hold reference to list in interator

Current implementation of LinearSeqLike.iterator holds
reference to complete sequence. This prevent garbage collecting
of List elements while we keep reference to iterator somewhere.

This commit removes reference from Iterator implementation. This
allow garbage collection of List while we iterating over its
elements (when there is no other references to List in our program).

Test program posted to https://issues.scala-lang.org/browse/SI-8924.
It is hard to turn it into unit test since it run relatively long,
creates GC pressure and run's out of memory on failure.