mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix memory limit
This commit is contained in:
6 files changed
+13
-9
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user