[llvm-branch-commits] [llvm] 561944e - [lit] Explicitly unset timer to free thread stack (#188717)

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


Author: Nikita Popov
Date: 2026-03-30T15:07:15Z
New Revision: 561944ebcbd164bc7fc5716c641476b14085fa13

URL: https://github.com/llvm/llvm-project/commit/561944ebcbd164bc7fc5716c641476b14085fa13
DIFF: https://github.com/llvm/llvm-project/commit/561944ebcbd164bc7fc5716c641476b14085fa13.diff

LOG: [lit] Explicitly unset timer to free thread stack (#188717)

Currently the virtual address space usage of lit fluctuates wildly, with
peak usage exceeding 4GB, which results in subsequent thread spawning
errors on 32-bit systems.

The cause of this is a circular reference in TimeoutHelper._timer (via the
callback), which causes the 8MB thread stack to not be immediately
reclaimed when the timer is cancelled.

We can avoid this by explicitly unsetting the timer.

(cherry picked from commit dfefc03769f58d8982202276cd3381356da12dfe)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 0d151ff96583e..93f03624f9984 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -127,6 +127,8 @@ def cancel(self):
         if not self.active():
             return
         self._timer.cancel()
+        # Break reference cycle so that thread stack is freed immediately.
+        self._timer = None
 
     def active(self):
         return self.timeout > 0


        


More information about the llvm-branch-commits mailing list