I am executing some performance tests on a messaging framework within python, and I am trying to make sure that the code is properly cleaning up after itself.
Is there a way to monitor the current number of threads owned by the process? Is there a better way to tell if I am leaking threads?
Just to make sure I clarify what I am looking for as an answer. I need a script and or program that can monitor the number of threads that a process has alive.
This function will tell you how many threads are currently alive:
threading.activeCount(). You can also enumerate those threads using thethreading.enumerate()function.