title: Close Python Thread To Prevent Memory Leak
body: <p>How to I close a Python thread in order to make sure that everything in memory within a thread is cleared from memory? Currently, I have a list of threads that I join in the following manner:</p>
  
  <pre><code>for t in threadlist:
      t.join(5)
  </code></pre>
  
  <p>These threads were originally created looping over a list of arguments to pass to each thread with <code>myfunc</code> which appends results to a list:</p>
  
  <pre><code>threadlist = []
  for r in arglist:
      t = Thread(target=myfunc, args=(r,))
      t.daemon = True
      threadlist.append(t)
  </code></pre>
  
  <p>When I look at what's in memory with <code>pympler</code> all manner of things in the function called by the thread remain in memory after this executes. I need it to garbage collect as it would if I called <code>myfunc</code> normally without threading.</p>