mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: fix memory limit
This commit is contained in:
6 files changed
+13
-9
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "3.4.1",
|
||||
"version": "3.4.2",
|
||||
"main": "./src/index.ts",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
@@ -9,9 +9,9 @@
|
||||
"@hydrooj/utils": "workspace:^",
|
||||
"adm-zip": "0.5.14",
|
||||
"cac": "^6.7.14",
|
||||
"p-queue": "^8.0.1",
|
||||
"schemastery": "^3.14.7",
|
||||
"semver": "^7.6.3",
|
||||
"p-queue": "^8.1.0",
|
||||
"schemastery": "^3.15.0",
|
||||
"semver": "^7.7.0",
|
||||
"shell-quote": "^1.8.2",
|
||||
"superagent": "^10.1.1",
|
||||
"ws": "^8.18.0"
|
||||
@@ -21,6 +21,6 @@
|
||||
"devDependencies": {
|
||||
"@types/adm-zip": "^0.4.34",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"@types/ws": "^8.5.13"
|
||||
"@types/ws": "^8.5.14"
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -33,6 +33,7 @@ langs:
|
||||
- ~ Key marked with a ? means the option is optional
|
||||
- (name):
|
||||
disabled?: whether to disable this language
|
||||
hidden?: won't show in the language selection
|
||||
compile?: Compile Command
|
||||
code_file?: Where to write code file when compiling, defaults to `foo.[name]`
|
||||
execute: Command to execute the program
|
||||
@@ -42,6 +43,7 @@ langs:
|
||||
target?: Compiler output file, defaults to `foo`
|
||||
display: Display name
|
||||
compile_time_limit?: Compile time limit, in milliseconds
|
||||
compile_memory_limit?: Compile memory limit, in MB
|
||||
address_space_limit?: Enable address space memory limit as CCF did
|
||||
process_limit?: Limit the number of thread
|
||||
bash:
|
||||
|
||||
Reference in new issue
Block a user