title: Memory leak in Ionic(or angular)?
body: <p>I'm new to both Ionic and Angular, so I'm not sure where the problem would actually lie between the two(if either).  I seem to have a problem with ng-repeat not clearing memory.  I've written a bare bones example to demonstrate</p>
  
  <p><a href="http://codepen.io/pen/pvQyxj" rel="nofollow noreferrer">http://codepen.io/pen/pvQyxj</a></p>
  
  <p>index.html</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"&gt;
      &lt;title&gt;&lt;/title&gt;
  
      &lt;link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"&gt;
  
      &lt;!-- ionic/angularjs js --&gt;
      &lt;script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"&gt;&lt;/script&gt;
      &lt;script src="cordova.js"&gt;&lt;/script&gt;
      &lt;script src="js/app.js"&gt;&lt;/script&gt;
  
    &lt;/head&gt;
    &lt;body ng-app="starter"&gt;
  
      &lt;ion-pane&gt;
        &lt;ion-header-bar class="bar-stable"&gt;
          &lt;h1 class="title"&gt;Ionic Blank Starter&lt;/h1&gt;
        &lt;/ion-header-bar&gt;
        &lt;ion-content ng-controller="CardsCtrl"&gt;
      &lt;div ng-repeat="card in cards" on-tap="start(1000)"&gt;
          &lt;img ng-src="{{card.image}}"&gt;
      &lt;/div&gt;
        &lt;/ion-content&gt;
      &lt;/ion-pane&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>js/app.js</p>
  
  <pre><code>angular.module('starter', ['ionic'])
  
  .run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      if(window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      }
      if(window.StatusBar) {
        StatusBar.styleDefault();
      }
    });
  
  }).controller('CardsCtrl', function($scope) {
      $scope.cards = [];
  
  
      var addCards = function(_num, y) {
          for (var x = 0; x &lt; _num; x++) 
          {
              $scope.cards.push({
                  image:"http://i.imgur.com/QR8mZAt.jpg?"+y
              }); 
          }
      }
      addCards(1, "new");
  
      var cardDestroyed = function(y) {
  
          //console.log("destroy");
          $scope.cards.splice(0, 1);
          addCards(1, y);
      };
  
      $scope.start = function(y){
          console.log("start");
          for (var x = 0; x &lt; y; x++)
          {
              cardDestroyed(y);
          }
          console.log("stop");
      }
  })
  </code></pre>
  
  <p>every time you click the picture, the array ng-repeat is using will have an element removed and added 1000 times.  But there is something sticking around in memory, causing my actual app to crash.</p>
  
  <p><img src="https://i.stack.imgur.com/ueHbc.png" alt="ionic/angularjs memory leak"></p>
  
  <p>Can anyone shed some insight as to if I'm doing something wrong, or if it's actually a bug?  I've looked through github and haven't seen a bug report which matches what I'm seeing, and once I've determined it's not just me doing something wrong I'll go make a report.</p>