diff options
-rw-r--r-- | pym/_emerge/actions.py | 9 | ||||
-rw-r--r-- | pym/_emerge/main.py | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 3336e9fca..c403d8974 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -3426,7 +3426,14 @@ def repo_name_duplicate_check(trees): return bool(ignored_repos) -def run_action(settings, trees, mtimedb, myaction, myopts, myfiles): +def run_action(settings, trees, mtimedb, myaction, myopts, myfiles, + gc_locals=None): + + # The caller may have its local variables garbage collected, so + # they don't consume any memory during this long-running function. + if gc_locals is not None: + gc_locals() + gc_locals = None # skip global updates prior to sync, since it's called after sync if myaction not in ('help', 'info', 'sync', 'version') and \ diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index fd1fd069b..ef94a4760 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -999,4 +999,5 @@ def emerge_main(args=None): tmpcmdline.extend(args) myaction, myopts, myfiles = parse_opts(tmpcmdline) - return run_action(settings, trees, mtimedb, myaction, myopts, myfiles) + return run_action(settings, trees, mtimedb, myaction, myopts, myfiles, + gc_locals=locals().clear) |