Memory Limit Exceeded

From EjudgeWiki
(Redirected from Memory Limit Exceeded)

Navigate: Main page/Система ejudge/Использование/Вердикты тестирования/Ошибка превышения лимита памяти

Английское название: Memory Limit Exceeded, ML

An error is diagnosed if the testing program consumes more memory during its operation than specified in the task limits. The validity of diagnosing this error is debatable (see below).

Different testing systems approach the memory limit for a running program in different ways. In ejudge, the memory limit is implemented by setting a limit on the size of the virtual address space and the size of the stack (see. ulimit). Thus, the program under test cannot exceed the set limits.

Diagnosing an ejudge out-of-memory error only works if a patch to the Linux kernel is installed. If the patch is not installed, the memory limit exceeded will be diagnosed as a runtime error. In addition, the ejudge system allows you to disable the diagnosis of this error even if a kernel patch is installed.

Although diagnosing this error can be useful for participants to debug their solutions, in most situations the line between a program execution error and a memory limit error is very blurry.

For example, if the maximum stack size has been exceeded because the program has entered an infinite recursion, then this situation should rather be considered an error in program execution. But on the other hand, if the program tried to allocate too much memory on the stack (for example, because the local array was too large), this situation should be considered as exceeding the memory limit. Naturally, it is impossible to clearly distinguish between these two situations in a simple way.

On the other hand, for example, in the C language, the malloc function returns NULL if the memory could not be allocated. If the program under test does not check the result of the malloc function for NULL and receives a null pointer access error, then this is a typical programmer's error and should be considered as a program execution error. Conversely, the program can catch situations when malloc returns NULL and modify its behavior (for example, by clearing the hash table).