ThreadPopulationWatch
Samples this process's thread count and runs it past ThreadPopulationMonitor.
| Inherits | QObject |
In the namespace monitor. Declared in src/libs/libmonitor/monitor/ThreadPopulationWatch.hpp.
Detailed description
The policy is pure and testable; this is the part that has to touch the operating system, kept separate for exactly that reason.
**Deliberately does NOT reuse `ThreadSampler`.** That one returns an empty list on any non-Linux platform (`NullThreadSampler`), so a population read through it would be **0 on Windows** — and Windows is where this leak reached 7,838 threads and degraded a person's machine. A monitor that is blind on the platform that motivated it is worse than none, because its silence reads as health.
Driven by `PinnedWatchdogThread` rather than a `QTimer`, matching ThreadRunawayDetector: a thread-population runaway is exactly the condition under which the GUI thread is least likely to be servicing timers.