OutOfMemoryError: Java heap space during LazyList evaluation
Memory Retention in Scala LazyList When processing large datasets using scala.collection.immutable.LazyList , the application may encounter heap exhaustion despite the intended lazy evaluation. This behavior typically occurs when a reference to the head of the list is maintained while the tail is being evaluated, preventing the garbage collector from reclaim