Hi,

Am 04.07.2009 um 17:11 schrieb Lennart Staflin:

I don't think this explains it. It is a OutOfMemoryError not a stack
overflow. It is not a recursion problem. I think it is that nth hangs
on to the head of the lazy fib sequence, and therefor all the elements
including the big integers can not be garbage collected.

The xth function does not hang on to the head, and all the
intermediate elements can be garbage collected.

This was my first thought, too. But this is not
the case. If the collection "is" Sequential, the
seq is obtained from it via seq() and then the
original pointer is nulled. Maybe this gets
optimised away by the JVM?

Sincerely
Meikel

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to