diff --git a/core/sandbox.cpp b/core/sandbox.cpp index d453140..9c304ba 100644 --- a/core/sandbox.cpp +++ b/core/sandbox.cpp @@ -287,8 +287,6 @@ static Result *run(Context *ctx) { // 走到这了说明出错了 exit(EXIT::PRE_JUDGE_EXECLP); } else { - long int init_mem = -1; - // 父进程 int status = 0; // 子进程状态 int syscall_id = 0; // 系统调用号 @@ -303,14 +301,8 @@ static Result *run(Context *ctx) { exit(EXIT::JUDGE); } - if (init_mem < 0) { - // 记录启动时使用的内存 - init_mem = rused.ru_maxrss; - FM_LOG_TRACE("Init memory: %d KB", init_mem); - } - // MLE, using ru_maxrss (since Linux 2.6.32) - result->memory = std::max((long int) result->memory, rused.ru_maxrss - init_mem); + result->memory = std::max((long int) result->memory, rused.ru_maxrss); if (result->verdict == Verdict::SE && result->memory > ctx->memory_limit) { result->verdict = Verdict::MLE; FM_LOG_TRACE("Memory Limit Exceeded (%d KB)", result->memory); diff --git a/core/test/run.py b/core/test/run.py index 7790e39..166247c 100644 --- a/core/test/run.py +++ b/core/test/run.py @@ -46,7 +46,7 @@ def run(executable, checker, source, testcase, expected): commands = [executable, "-d", tmp_dir, "-l", source.split('.')[-1], "-s", checker] if is_c_cpp: # Restrict c/cpp memory usage - commands += ["-m", str(4 * 1024)] + commands += ["-m", str(8 * 1024)] code = subprocess.call(commands, cwd=os.path.dirname(executable))