title: memory consumed by a thread in python
body: <p>Here I can get the time take by thread to complete. How can I get the memory consumed by the thread.</p>
  
  <pre><code>import threading
  import time
  class mythread(threading.Thread):
      def __init__(self,i,to):
          threading.Thread.__init__(self)
          self.h=i
          self.t=to
          self.st=0
          self.end=0
      def run(self):
          self.st =time.time()
          ls=[]
          for i in range(self.t):
              ls.append(i)
              time.sleep(0.002)
          self.end=time.time()
          print "total time taken by {} is {}".format(self.h,self.end-self.st)
  thread1=mythread("thread1",10)
  thread2=mythread("thread2",20)
  thread1.start()
  thread2.start()
  thread1.join()
  thread2.join()
  </code></pre>