MikeMirzayanov's blog

By MikeMirzayanov, 9 years ago, In Russian

Hello!

Recently there were some comments about unexpected MLE verdict for Java solutions.

Now we experimentally run Java with the following command line (it is a part relevant to memory): -XX:NewRatio=5 -Xms8M -Xmx<ML> -Xss64M.

It is good to know that default java GC divides heap to generations (areas) and tenured (old) generation is less than entire heap size. We use -XX:NewRatio=5 to increase the tenured generation size. For example, if memory limit is 256M then tenured generation is about 200MB. For example, it means that you can not allocate array of size 210MB in your program. Note, that without -XX:NewRatio=5 the tenured generation size is ~170MB.

Also I tried option to use G1 garbage collector, but it seems it works much slower for programming competition codes.

If you want to suggest improvements, please test your suggestion on the following cases:

Note, we use javaagent for JVM to intercept java.lang.OutOfMemoryException exceptions and return them as MLE verdict. It doesn't affect StackOverflowException or any other exception.

Also we use hard memory limit per process (because of possible off-heap allocations) which is about 20MB larger than ML (~20MB is memory consumed by simple almost empty solution).

BTW, what options use Yandex.Contest, ejudge, PCMS2 and other judges to run Java?

  • Vote: I like it
  • +34
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Note, we use javaagent for JVM to intercept java.lang.OutOfMemoryException exceptions and return them as MLE verdict. It doesn't affect StackOverflowException or any other exception.

But both can happen at the same time somehow 16624623