According to the blog about languages, the -Xmx
option for Java is set to 512M
. So consider 1097F - Alex and a TV Show from Hello 2019, with a ML of 256M
. In this problem, my submission 47948716 takes > 200M
memory. With n = 1e5
, q = 1e6
, t = 1
, x = <cycle through 1 .. n>
, v = 1
,the code takes ~207M
on Custom Test. But by setting -Xmx130M
, this still runs on my system in time (without -Xmx
it took ~270M
on my system). This probably means that Java doesn't garbage collect as it still has memory left.
Also according to the following StackOverflow answer: ...Java will use as much memory as it is allowed to, at which point it will garbage collect. To work around this, you can specify a smaller max heap size in the JVM settings. You do this with the -Xmx setting....
Since Codeforces sets the -Xmx
to 512M
and many problems have ML 256M
, is it possible that a piece of code continues to take up memory (since it can go upto 512M
) without garbage collecting, and consequently gets MLE
verdict, when it could have actually done with 256M
and some garbage collection?
It did happen to me once but not on CF(I think it was on Yandex.Contest)
It seems possible. Idk if there are any guards against that on CF.
Hi, we don't use
-Xmx512M
now. Please, read https://mirror.codeforces.com/blog/entry/43696Oh, didn't find that during search. Thanks! That's reassuring.