title: Swift - garbage collection - something gets left behind
body: <p>I'm fairly new to iOS development, so I apologize in advance if my question sounds not worthy of being on stackoverfow.</p>
  
  <p>I am building a simple game with a home ViewController and a gameplay ViewController as far as the structure is concerned.  </p>
  
  <p>I've added a very simple function to kill activities to make sure nothing gets left behind, which gets called right before it leaves the gameplay ViewController.  the following is the code I'm using:</p>
  
  <pre><code>private func cleanThis(){  
  
     //removing objects from array
     activeEnemies.removeAll()
  
     //removing objects from array
     activeTargets.removeAll()
  
     //removing the rest
     let subViews = self.view.subviews
     for subview in subViews{
        subview.removeFromSuperview()
     }
  }
  </code></pre>
  
  <p>I must be missing something here, and when I test it without moving on to the homepage, there's a constant memory activity of 38MB.  And I haven't figured out yet as to how to monitor what is still left in the ViewController.  </p>
  
  <p>Any help is much appreciated. </p>
  
  <p>p.s. when there's no objects in ViewController, the memory activity should be 0, is this correct?</p>