Does Python's garbage collector harm my application?

Is it bad in Python, when I don't hold a reference of a Thread I created with: threading.Thread(target=worker_method)? Is it possible that the garbage collecor does anything to it, which affects the stability of my application?


The thread will keep running regardless, but the downside is that you don't have a handle to the thread any more in order to communicate with it.

A simple test shows that even when the thread object goes out of scope, its still running:

from threading import Thread
from time import sleep

def t_func():
    print "Sleeping"
    print "Done Sleeping"

def test():
    t = Thread(target=t_func)

>>> test()
Done Sleeping

Even if you were to delete the t thread object right after starting it, it will keep running. But you really should be keeping track of thread that you start, to make sure they finish or to monitor if they are alive. And also, to shut them down cleanly if need be.

Need Your Help

Frama-C syntax error?

c graph dot frama-c

I have an entry point that I want to run pdg-dot on, however after I moved the header files to be in the right place I get this syntax error.