I have run the following code in Eclipse:

```
Stream.generate(() -> "Elsa")
      .filter(n -> n.length() ==4)
      .sorted()
      .limit(2)
      .forEach(System.out::println);

```

The output is:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

What I was expecting since the limit is two:

```
Elsa
Elsa

```

Can someone please explain why this is an infinite stream?