Skip to content

Commit 690b442

Browse files
committed
Fixes DependableSystemsLab#3 by escaping the rlimit modification on non-Linux systems
1 parent 2735caf commit 690b442

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

bin/analyzer.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import shlex
1010
import re
1111
import time
12+
import platform
1213
from src.project import Project
1314
from src.cfg import opcodes
1415
from src.slicing import interesting_slices, slice_to_program
@@ -242,16 +243,17 @@ def main():
242243

243244
savefilebase = args.savefile or args.file
244245

245-
# limit default memory to 6GB
246-
if args.memory:
247-
mem_limit = int(args.memory) * 1024 * 1024 * 1024
248-
else:
249-
mem_limit = 6 * 1024 * 1024 * 1024
250-
try:
251-
rsrc = resource.RLIMIT_VMEM
252-
except:
253-
rsrc = resource.RLIMIT_AS
254-
resource.setrlimit(rsrc, (mem_limit, mem_limit))
246+
# limit default memory to 6GB on Linux
247+
if platform.system() == 'Linux':
248+
if args.memory:
249+
mem_limit = int(args.memory) * 1024 * 1024 * 1024
250+
else:
251+
mem_limit = 6 * 1024 * 1024 * 1024
252+
try:
253+
rsrc = resource.RLIMIT_VMEM
254+
except:
255+
rsrc = resource.RLIMIT_AS
256+
resource.setrlimit(rsrc, (mem_limit, mem_limit))
255257

256258
initial_storage = dict()
257259
if args.initial_storage_file:

0 commit comments

Comments
 (0)