Project: titanium
Issue TIMOB-7897: Android: Memory leak by windows not properly cleaning up after close.
Windows appear to be leaking memory by not properly cleaning up after they have been closed. This only affects "heavy" windows that have their own activity. h3. Test Case: Opening a window and adding many child views. Run the application and click the button to open a window. Wait for an alert dialog to popup telling you its okay to back out now. Hit the back button to close out the window. Repeat this process. Expected: Memory usage should peak and remain steady. Actual: Memory usages constantly rises until out of memory crash occurs. {code:javascript} function mainViews() { var newWin = Ti.UI.createWindow({ navBarHidden: true }); Ti.API.info('****** mainViews function has started ******'); var views =[]; var view = null; for (var i=0; i < 500; i++) { view = Ti.UI.createView(); views.push(view); newWin.add(view); } newWin.open(); alert("You may click back now."); Ti.API.info('Titanium views created and added to array'); Ti.API.info('****** mainViews function has stopped ******'); } var win = Ti.UI.createWindow({ backgroundColor: "white" }); var button = Ti.UI.createButton({ title: "create 5k views" }); button.addEventListener("click", function(e) { mainViews(); Ti.API.info('Available memory: ' + Ti.Platform.availableMemory); }); win.add(button); win.open(); {code}
Story points: 1