missingfaktor
missingfaktor

Reputation: 92046

OutOfMemoryError on evaluation of a 2D stream

Why does the following lead to OutOfMemoryError?

scala> Stream.tabulate(3, 4)(_ + _)
res0: scala.collection.immutable.Stream[scala.collection.immutable.Stream[Int]] = Stream(Stream(0, ?), ?)

scala> res0.length

The same happens on application of size and force methods.

Upvotes: 2

Views: 163

Answers (1)

Rustem Suniev
Rustem Suniev

Reputation: 1149

There is a bug in 2.8: "Stream.tabulate creates an infinite stream"

Have a look. http://lampsvn.epfl.ch/trac/scala/ticket/3508

Upvotes: 6

Related Questions