So I can build Rakudo for the JVM no problem on a rather beefy server.
When I tried it on a desktop with 2GB it fails:
$ java
-Xbootclasspath/a:.:/home/nick/Perl/rakudo/nqp/install/nqp-runtime.jar:/home/nick/Perl/rakudo/nqp/install/asm-4.1.jar:/home/nick/Perl/rakudo/nqp/install/jline-1.0.jar:rakudo-runtime.jar
-cp /home/nick/Perl/rakudo/nqp/install perl6 --setting=NULL --optimize=3
--target=classfile --stagestats --output=CORE.setting.class src/gen/CORE.setting
Stage start : 0.000
Stage parse : 77.657
Stage syntaxcheck: 0.000
Stage ast : 0.000
Stage optimize : 4.934
Stage jast : 37.581
java.lang.OutOfMemoryError: Java heap space
in dump
in <anon>
in dump
in classfile
in <anon>
in compile
in eval
in evalfiles
in command_eval
in command_eval
in command_line
in MAIN
in <anon>
in <anon>
A bit of Googling reveals that the heap space can be altered with -Xmx, and
it seems that I can get the current value like this:
$ java -XshowSettings
VM settings:
Max. Heap Size (Estimated): 592.00M
Ergonomics Machine Class: server
Using VM: OpenJDK 64-Bit Server VM
[snip lots more exciting information]
So, boosting it to a gig works:
$ java -Xmx1024m
-Xbootclasspath/a:.:/home/nick/Perl/rakudo/nqp/install/nqp-runtime.jar:/home/nick/Perl/rakudo/nqp/install/asm-4.1.jar:/home/nick/Perl/rakudo/nqp/install/jline-1.0.jar:rakudo-runtime.jar
-cp /home/nick/Perl/rakudo/nqp/install perl6 --setting=NULL --optimize=3
--target=classfile --stagestats --output=CORE.setting.class src/gen/CORE.setting
Stage start : 0.000
Stage parse : 78.145
Stage syntaxcheck: 0.001
Stage ast : 0.001
Stage optimize : 6.578
Stage jast : 30.003
Stage classfile : 14.435
(and I can get to "Hello world". Although I admit I haven't figured out
command line arguments yet)
Anyway, the most interesting thing was actually the suggestion in this
answer on stack overflow:
http://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap/186390#186390
Yes, with -Xmx you can configure more memory for you JVM. To be
sure that you don't leak or waste memory. Take a heap dump and use
the Eclipse Memory Analyzer to analyze your memory consumption.
Does that sound familiar enough to someone to be tempting?
Nicholas Clark