Hi Anand,
On 10-12-15 04:51, Br. Anand Shenoi wrote:
Hi All,
In in contest with 300+ users, how can we ensure that java heap / memory problem doesn't arise? When we say 64 MB for one problem, then does it mean the 64 MB includes the size of test cases to be loaded for that problem, for one user?
This is a difficult issue for Java. First, the memory limit is enforced onto the whole running program, which means for Java (and any other interpreted/byte-code language) that the memory use of the interpreter is included. This means that it is impossible to enforce the same memory limits on underlying contestant code when one is in C/C++ and the other in Java. Hence, when using both, you should always keep some overhead for Java and thus very strict memory limits are impossible I would say.
Secondly, within Java, it is clear what the memory limit is: this is the one calculated inside the Java compile script.
Whether this includes the size of the test cases, depends entirely on the way that the contestants' solution reads these: if they read the whole input into memory, then, yes. But if they read and process, say, line after line, then they would require only that much. In other words: there is no part in DOMjudge itself that reads the test case data and counts towards the memory limit.
And what all issues related with Java can we expect?
That's a very broad and difficult question to answer.
First of all, the default Java script already detects (public) class/file name issues, which takes care of quite a few beginners' problems.
Secondly, you should be aware that some Java I/O methods can be *really* slow, so contestants should use the right ones. I don't know these details by heart, but at least one should use buffered readers/writers on large in/output files, see the team manual code example.
Best, Jaap