Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions codeflash/verification/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ class UnexpectedError(Exception):
pass


import platform
if platform.system() == 'Linux' or platform.system() == 'Darwin':
import resource
import os

# Get total system memory
total_memory = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') # Set memory limit to 80% of total system memory
memory_limit = int(total_memory * 0.8)

# Set both soft and hard limits
resource.setrlimit(resource.RLIMIT_AS, (memory_limit, memory_limit))


def pytest_addoption(parser: Parser) -> None:
"""Add command line options."""
pytest_loops = parser.getgroup("loops")
Expand Down
Loading