diff --git a/locust/main.py b/locust/main.py index 61f8692be8..bd1ec6604b 100644 --- a/locust/main.py +++ b/locust/main.py @@ -4,6 +4,7 @@ import atexit import errno +import gc import inspect import json import logging @@ -204,6 +205,9 @@ def is_valid_percentile(parameter): "--master cannot be combined with --processes. Remove --master, as it is implicit as long as --worker is not set.\n" ) sys.exit(1) + # Optimize copy-on-write-behavior to save some memory (aprx 26MB -> 15MB rss) in child processes + gc.collect() # avoid freezing garbage + gc.freeze() # move all objects to perm gen so ref counts dont get updated for _ in range(options.processes): child_pid = gevent.fork() if child_pid: