File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 3636 dedent ,
3737 indent ,
3838)
39+ import resource
40+
3941from threading import Thread
4042from typing import (
4143 Dict ,
@@ -129,6 +131,10 @@ def guess_paths_to_mutate():
129131 'Could not figure out where the code to mutate is. '
130132 'Please specify it on the command line using --paths-to-mutate, '
131133 'or by adding "paths_to_mutate=code_dir" in setup.cfg to the [mutmut] section.' )
134+
135+ def limit_memory (maxsize ):
136+ soft , hard = resource .getrlimit (resource .RLIMIT_AS )
137+ resource .setrlimit (resource .RLIMIT_AS , (maxsize , hard ))
132138
133139
134140def record_trampoline_hit (name ):
@@ -1226,6 +1232,7 @@ def read_one_child_exit_status():
12261232 # In the child
12271233 os .environ ['MUTANT_UNDER_TEST' ] = mutant_name
12281234 setproctitle (f'mutmut: { mutant_name } ' )
1235+ limit_memory (1000 * 1000 * 500 )
12291236
12301237 # Run fast tests first
12311238 tests = sorted (tests , key = lambda test_name : mutmut .duration_by_test [test_name ])
You can’t perform that action at this time.
0 commit comments