According to the blog about languages, the
-Xmx option for Java is set to
512M. So consider 1097F - Алексей и телешоу 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
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?