Skip to content

Commit

Permalink
make memory work with languages.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuenni committed Jan 23, 2025
1 parent e0e4065 commit 4be0e1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run_interactive_testcase(

timelimit = run.problem.settings.timelimit
timeout = run.problem.settings.timeout
memory = run.problem.limits.memory
memory = run.submission.memory

# Validator command
def get_validator_command():
Expand Down
3 changes: 2 additions & 1 deletion bin/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def __init__(
self.run_command: Optional[list[str]] = None
self.hash: Optional[str] = None
self.env: dict[str, int | str | Path] = {}
self.memory: Optional[int] = None

self.ok = True
self.built = False
Expand Down Expand Up @@ -275,7 +276,7 @@ def _get_language(self, bar: ProgressBar):
'mainclass': mainclass,
'Mainclass': mainclass[0].upper() + mainclass[1:],
# Memory limit in MB.
'memlim': 2048,
'memlim': self.memory or 2048,
# Out-of-spec variables used by 'manual' and 'Viva' languages.
'build': (
self.tmpdir / 'build' if (self.tmpdir / 'build') in self.input_files else ''
Expand Down
3 changes: 2 additions & 1 deletion bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def __init__(self, problem, path, skip_double_build_warning=False):

self.verdict = None
self.duration = None
self.memory = problem.limits.memory

# The first element will match the directory the file is in, if possible.
self.expected_verdicts = self._get_expected_verdicts()
Expand Down Expand Up @@ -319,7 +320,7 @@ def run(self, in_path, out_path, crop=True, args=[], cwd=None, default_timeout=F
stdout=out_file,
stderr=None if out_file is None else True,
timeout=True if default_timeout else self.problem.settings.timeout,
memory=self.problem.limits.memory,
memory=self.memory,
cwd=cwd,
)
if out_file:
Expand Down

0 comments on commit 4be0e1b

Please sign in to comment.