Memory leak when using threads and tkinter Memory leak when using threads and tkinter tkinter tkinter

Memory leak when using threads and tkinter


(As far as I know Tkinter is NOT threadsafe. This may cause this problem. So using threads with Tkinter isn't a great idea. I'm not even sure that you really need multithreading for this.)

Edit: Seems like you are just killing your childthread with this, the mainthread is still running.

But to solve your problem, one way is to force-"kill" the whole processtree. All you need is your script pid and a subprocess function. Try this code in your killGUI:

def killGUI(self):    try:        subprocess.call(['taskkill', '/F', '/T', '/PID', str(os.getpid())])        print("Process killed: %s " % str(os.getpid()))    except Exception as ex:        print(ex)

This will kill your thread for sure.