[llvm] [lit] Explicitly unset timer to free thread stack (PR #188717)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 26 03:33:20 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: Nikita Popov (nikic)
<details>
<summary>Changes</summary>
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 threading._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.
---
Full diff: https://github.com/llvm/llvm-project/pull/188717.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/TestRunner.py (+2)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/188717
More information about the llvm-commits
mailing list