[llvm-branch-commits] [llvm] 5846877 - [lit] dealloc ApplyResult objects as they're waited on (#188642)

Cullen Rhodes via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 30 08:07:25 PDT 2026


Author: Nick Begg
Date: 2026-03-30T15:07:15Z
New Revision: 58468775a5e2c488b1e42f489bb3237ca377a5af

URL: https://github.com/llvm/llvm-project/commit/58468775a5e2c488b1e42f489bb3237ca377a5af
DIFF: https://github.com/llvm/llvm-project/commit/58468775a5e2c488b1e42f489bb3237ca377a5af.diff

LOG: [lit] dealloc ApplyResult objects as they're waited on (#188642)

In _wait_for(), all async tasks are waited for. However, the objects
are held in the async_result list until the function calls complete.
This leads to about 3.6gig mem usage on my system when running
check-llvm, even though these objects aren't needed after the ar.get()
call.

Dealloc them as we go instead.

Addresses #188641

(cherry picked from commit b7d8831f8c432db97e5fcd5acdc470e7a82c92b2)

Added: 
    

Modified: 
    llvm/utils/lit/lit/run.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py
index 9c54511bfd625..fb18a60db1b39 100644
--- a/llvm/utils/lit/lit/run.py
+++ b/llvm/utils/lit/lit/run.py
@@ -142,8 +142,10 @@ def _execute(self, deadline):
 
     def _wait_for(self, async_results, deadline):
         timeout = deadline - time.time()
-        for idx, ar in enumerate(async_results):
+        idx = 0
+        while len(async_results) > 0:
             try:
+                ar = async_results.pop(0)
                 test = ar.get(timeout)
             except multiprocessing.TimeoutError:
                 raise TimeoutError()
@@ -153,6 +155,7 @@ def _wait_for(self, async_results, deadline):
                     self.failures += 1
                     if self.failures == self.max_failures:
                         raise MaxFailuresError()
+            idx += 1
 
     # Update local test object "in place" from remote test object.  This
     # ensures that the original test object which is used for printing test


        


More information about the llvm-branch-commits mailing list