title: Threading using less RAM than Popen, why?
body: <p>I have a question, So  I am testing RAM usage of my script and it is as easy as:</p>
  <p>a script that is a start up, that script opens up 4 python script in a while loop and loops forever.</p>
  <p>I tested 2 things. One with just calling Popen for each script and one using threading and I found out that there is a huge difference between each other...</p>
  <p>The script with threading:<a href="https://i.stack.imgur.com/NPCGk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NPCGk.png" alt="Threading" /></a></p>
  <p>And a script that uses Popen to open up the scripts:</p>
  <p><a href="https://i.stack.imgur.com/t0hal.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t0hal.png" alt="Popen" /></a></p>
  <p>Since they both do the exact same thing, why does the Python threading uses so much less RAM than the other that opens up the script? What are the advantage vs. disadvantage of using the threading vs. Popen?</p>
  <p><strong>test2:</strong></p>
  <pre><code>import time
  
  
  def testing():
      while True:
          test = &quot;Helllo world&quot;
          print(test)
          time.sleep(1)
  
  
  if __name__ == '__main__':
      testing()
  </code></pre>
  <p><strong>threading</strong>.py:</p>
  <pre><code>import threading
  
  from test2 import testing
  
  threading.Thread(target=testing()).start()
  threading.Thread(target=testing()).start()
  threading.Thread(target=testing()).start()
  </code></pre>
  <p><strong>Popen</strong>:</p>
  <pre><code>from subprocess import Popen
  
  for _ in range(4):
      Popen(f&quot;py test2.py&quot;, shell=True).communicate()
  </code></pre>