judge: fix memory limit

This commit is contained in:
undefined committed 2025-02-02 16:43:02 +08:00
1 parent f3eb6ca55c
commit f2121180ae
6 files changed
+13 -9

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ export default async function compile(
copyOutCached: [target],
env: { HYDRO_LANG: lang.key },
time: lang.compile_time_limit || 10000,
memory: lang.compile_memory_limit || 256 * 1024 * 1024,
memory: lang.compile_memory_limit || 256,
},
`compile[${lang.key}]`,
3,
+1 -1
View File
@@ -10,7 +10,7 @@ export async function compilerVersions(langs: Record<string, LangConfig>) {
const res = await runQueued(version, {
copyIn: {},
time: 10000,
memory: 256 * 1024 * 1024,
memory: 256,
}, 'compilerVersions', 5);
result[lang] = `${res.stdout}\n${res.stderr}`.trim();
}
+2 -2
View File
@@ -17,7 +17,7 @@ export const judge = async (ctx: JudgeTask) => {
copyIn: execute.copyIn,
// Allow 2x limits for better debugging
time: parseTimeMS(ctx.config.time || '1s') * 2,
memory: parseMemoryMB(ctx.config.memory || '128m'),
memory: parseMemoryMB(ctx.config.memory || '256m'),
filename: ctx.config.filename,
addressSpaceLimit: address_space_limit,
processLimit: process_limit,
@@ -32,7 +32,7 @@ export const judge = async (ctx: JudgeTask) => {
const message: string[] = [];
if (time > parseTimeMS(ctx.config.time || '1s')) {
status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
} else if (memory > parseMemoryMB(ctx.config.memory || '128m') * 1024) {
} else if (memory > parseMemoryMB(ctx.config.memory || '256m') * 1024) {
status = STATUS.STATUS_MEMORY_LIMIT_EXCEEDED;
} else if (code) {
status = STATUS.STATUS_RUNTIME_ERROR;
+2
View File
@@ -30,9 +30,11 @@ const statusMap: Map<SandboxStatus, number> = new Map([
]);
export interface Parameter {
/** in ms */
time?: number;
stdin?: CopyInFile;
execute?: string;
/** in MB */
memory?: number;
processLimit?: number;
addressSpaceLimit?: boolean;