Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escapes the rlimit modification on non-Linux systems #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
22 changes: 12 additions & 10 deletions bin/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import shlex
import re
import time
import platform
from src.project import Project
from src.cfg import opcodes
from src.slicing import interesting_slices, slice_to_program
Expand Down Expand Up @@ -242,16 +243,17 @@ def main():

savefilebase = args.savefile or args.file

# limit default memory to 6GB
if args.memory:
mem_limit = int(args.memory) * 1024 * 1024 * 1024
else:
mem_limit = 6 * 1024 * 1024 * 1024
try:
rsrc = resource.RLIMIT_VMEM
except:
rsrc = resource.RLIMIT_AS
resource.setrlimit(rsrc, (mem_limit, mem_limit))
# limit default memory to 6GB on Linux
if platform.system() == 'Linux':
if args.memory:
mem_limit = int(args.memory) * 1024 * 1024 * 1024
else:
mem_limit = 6 * 1024 * 1024 * 1024
try:
rsrc = resource.RLIMIT_VMEM
except:
rsrc = resource.RLIMIT_AS
resource.setrlimit(rsrc, (mem_limit, mem_limit))

initial_storage = dict()
if args.initial_storage_file:
Expand Down