[llvm] dfefc03 - [lit] Explicitly unset timer to free thread stack (#188717)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 26 08:58:30 PDT 2026
Author: Nikita Popov
Date: 2026-03-26T16:57:41+01:00
New Revision: dfefc03769f58d8982202276cd3381356da12dfe
URL: https://github.com/llvm/llvm-project/commit/dfefc03769f58d8982202276cd3381356da12dfe
DIFF: https://github.com/llvm/llvm-project/commit/dfefc03769f58d8982202276cd3381356da12dfe.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.
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 d856642e3f447..8bd44a8c30707 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -126,6 +126,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-commits
mailing list