[ALOY-435] UI Object Allocations with Alloy and Titanium Studio
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-03-08T23:05:48.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Runtime |
Labels | Allocations, Alloy, Memory, UI |
Reporter | AppDesign |
Assignee | Tony Lukasavage |
Created | 2012-12-19T17:57:45.000+0000 |
Updated | 2014-01-29T00:07:02.000+0000 |
Description
The attached project has only 1 window and 1 view with 10 buttons so that you could see the UI count in allocations. In the attached screen1.png you will see view1 with the 10 buttons. In the attached screen2.png - If you click the remove myself button you will see that the view is removed and nulls the global reference to the view and you are returned to the window (white). I stayed on the window for a long time on a couple of tests and it never cleaned up the UI objects from view 1. In attached screen3.png I opened view1 and clicked the remove myself button and the objects where cleaned up almost instantly. I can repeat this action over and over again and the objects clean up flawlessly. This confirms that if you went to a view and never returned to it, it would never be properly cleaned up. Here is a link to the simplified project and made it as "hello world" as I could in hopes of making the issue easier to spot. http://wwww.appdesigngeeks.com/simpleviewtest.zip Below is the simplified code from Alloy.js that does the open and close of view1 Alloy.globals.VARS = { globalParent: null, // Store ref to Parent Window of App globalCurrentView: null, // Store ref to current view being shown }; Alloy.globals.GVUpdate = function(inName, inValue) { Alloy.globals.VARS[inName] = inValue; }; Alloy.globals.GVOpenViewNew = function(viewName) { var openingview = Alloy.createController(viewName); // create controller Alloy.globals.VARS.globalParent.add(openingview.getView()); openingview.init(); Alloy.globals.VARS['globalCurrentView'] = openingview; }; Alloy.globals.CloseView = function() { Alloy.globals.VARS.globalParent.remove(Alloy.globals.VARS.globalCurrentView.getView()); // Remove Current View from Parent Alloy.globals.GVUpdate("globalCurrentView", null); // Cleanup by Releasing resources and memory for current view };Attachments
File | Date | Size |
---|---|---|
screen1 .png | 2012-12-19T17:57:45.000+0000 | 388659 |
screen2.png | 2012-12-19T17:57:45.000+0000 | 363100 |
screen3.png | 2012-12-19T17:57:45.000+0000 | 360694 |