title: In Kivy, why doesn't popup.dismiss() delete the popup from memory?
body: <p>I'm currently struggling with a memory usage problem in Kivy.</p>
  
  <p>When a popup is created and opened, memory usage goes up a little (which is normal), but when the user closes it (with the dismiss() method, which closes the popup and removes it from its parent), the memory isn't released.</p>
  
  <p>So, if the user decides to open the popup a lot of times, the program will eventually use a lot of memory. Here is a part of my code that shows the problem by creating, opening and then dismissing a popup 500 times.</p>
  
  <pre><code># py file
  class OptionsView(Screen):
  
      def popupLoop(self):
          for x in range(0, 500):
              popup = self.MyPopup()
              popup.open()
              popup.dismiss()
  
      class MyPopup(Popup):
          pass
  
  
  # kv file
  &lt;OptionsView&gt;:
      BoxLayout:
          orientation: "vertical"
          Button:
              text: "Popup Loop"
              on_press: root.popupLoop()
  
  &lt;MyPopup&gt;:
      size_hint: (.6, .6)
      title: "Confirmation"
      BoxLayout:
          Button:
              text: "Cancel"
              on_press: root.dismiss()
  </code></pre>
  
  <p>Pressing the "Popup Loop" button in the OptionView screen causes the program to jump from 1.2% memory usage to 11.7% (according to <code>top</code>). Resizing the window (which calls <code>gc.collect()</code>) does bring this number down a little bit, but it remains really high.</p>
  
  <p>How can I prevent this from happening? (Bear in mind that I'm far from being a Python/Kivy expert, so even if the solution is really obvious to you, please try to explain it to me!)</p>