scala_via_python: OOM when compiling with scalac

scala_via_python: OOM when compiling with scalac

de către Renaud Richardet-
Număr de răspunsuri: 2
I have followed the instructions in https://github.com/trampgeek/moodle-qtype_coderunner?tab=readme-ov-file#supporting-or-implementing-new-languages
to be able to support scala for exam questions. i have installed and tested scala and scalac on on the jobeinabox Docker container

i then have setup the following run_spec in the scala_in_python question template
{ "memorylimit": 1000, "numprocs": 128 }

And have explore a wide range of JVM settings, but no luck so far

scalac  -J-Xrs   -J-Xmx256m  -J-Xss256k  -J-XX:CompressedClassSpaceSize=64m  -J-XX:MetaspaceSize=64m  -J-XX:MaxMetaspaceSize=96m  -J-XX:ParallelGCThreads=1  -J-XX:CICompilerCount=2   prog.scala

I am always getting an out-of-memory error during compilation, or even worse (Could not allocate compressed class space: 67108864 bytes).

This is with a 1-line hello world program
object HelloWorld extends App{println("yes :-)")}

What would you recommend to make this work?

Thanks, Renaud
Ca răspuns la Renaud Richardet

Re: scala_via_python: OOM when compiling with scalac

de către Richard Lobb-
The JVM is a notorious memory gobbler, and it's difficult to run it under Linux ulimit memory restrictions, even without the complication of running it on top of Python. Try simply setting the Jobe memory limit to 0, which turns off the ulimit on memory, and removing all the memory limits on the scalac command. You should be able to trust the JVM to manage memory itself, at least sufficiently to prevent the Jobe from thrashing. You can add back JVM memory limits later if you have load problems on Jobe.