This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Another java.lang.StackOverflowError


> Suppose we use a trivial function (mk-list n) to produce a list
> of length n, then the first one works in
> 
>  (foldl + 0 (mk-list n))
> 
> for n less than or equal to 2000000. Beyond that, it gives OutOfMemoryError.

That's because your JVM is running out of memory for a list that big.
Just add more memory the the Java process:

    java -Xms300m -Xmx300m kawa.repl
    #|kawa:1|# (require 'list-lib)
    #|kawa:2|# (length (make-list 3000000 1))
    3000000

Your tail recursive foldl works fine for me:

    #|kawa:14|# (foldl + 0 (make-list 3000000 1))
    3000000

Was there another issue I'm missing?

Regards,
Chris Dean


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]