{ "id": "112622", "key": "TIMOB-13636", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2017-06-11T17:41:37.000+0000", "created": "2013-04-10T00:41:36.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-12T22:33:32.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h2. Problem\r\n\r\nWhen a modal window is created *and* a modalStyle is defined, a TiUIiPhoneProxy object is left behind as measured via Allocations in Instruments. Not specifying a modal style resolves this. It only manifests if modal & modalstyle & subsequent open.\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\n/*\r\n * Bug Sample -\r\n * \r\n * To reproduce:\r\n * 1) Launch this app in the iPad simulator on current iOS SDK\r\n * 2) Start Instruments, setup allocation to monitor the app after it starts so that your view isn't cluttered with the base window elements which are unimportant\r\n * 3) Filter Instruments to TiUI\r\n * 3a) Do not use 'Simulate Memory Warning' in the simulator unless instructed.\r\n * 4) Click the 'open modal window' button, close the modal window, repeat opening/closing 10 times. Note that objects all clear when automatically GC'd, and the number doesn't increment on anything past the last click waiting on GC\r\n * 5) Now, click 'simulate memory warning' in the simulator. Click 'open modal window' and then close it. Note that a new TiUiIphoneProxy has appeared in Instruments. This only occurs after the first modal has appeared and a memory warning has triggered, but it will show for all subsequent events\r\n * 6) Repeat clicking 'simulate memory warning', then clicking 'open modal window', then closing the window. Note that on 3.1.0.v20130405170202, the living count continues rising.\r\n * 7) Modify the code to remove the modal style, and everything will then properly zero out even with memory warnings\r\n */\r\n\r\n//simplified to just show a single window\r\n(function() {\r\n\t\r\n\t\r\n\t//create component instance\r\n\tvar self = Ti.UI.createWindow({\r\n\t\tbackgroundColor:'#ffffff'\r\n\t});\r\n\t\t\r\n\t//construct UI\r\n\tvar modalLaunchButton = Ti.UI.createButton({title : 'open modal window (breaks)', left: 20, right: 20, top:10, height:40});\r\n\tmodalLaunchButton.addEventListener('click',function(){\r\n\t\r\n\t\t//create component instance\r\n\t\tvar Window = Ti.UI.createWindow({\r\n\t\t\tbackgroundColor:'#ffffff'\r\n\t\t});\r\n\t\t\t\r\n\t\t//construct UI\r\n\t\tWindow.add(Ti.UI.createLabel({text: 'i am the modal window.If you close me, simulate a memory warning, and reopen me, i wont give up my TiUIiPhoneProxy object'}));\r\n\t\t\r\n\t\tvar closeNavBtn = Ti.UI.createButton({title : 'close'});\r\n\t\tcloseNavBtn.addEventListener('click',function(){\r\n\t\t\tWindow.leftNavButton = null;\r\n\t\t\tcloseNavBtn = null;\r\n\t\t\tWindow.close();\r\n\t\t\tWindow = null;\r\n\t\t});\r\n\t\tWindow.leftNavButton = closeNavBtn;\r\n\t\t\r\n\t\t\r\n\t\tWindow.open({\r\n\t\t\tmodal: true,\r\n\t\t\tmodalStyle: Ti.UI.iPhone.MODAL_PRESENTATION_FORMSHEET\r\n\t\t});\r\n\t});\r\n\tself.add(modalLaunchButton);\r\n\t\t\r\n\t//construct UI\r\n\tvar modalLaunchButtonWithoutStyle = Ti.UI.createButton({title : 'open modal window without style (passes)', left: 20, right: 20, top:100, height:40});\r\n\tmodalLaunchButtonWithoutStyle.addEventListener('click',function(){\r\n\t\r\n\t\t//create component instance\r\n\t\tvar Window = Ti.UI.createWindow({\r\n\t\t\tbackgroundColor:'#ffffff'\r\n\t\t});\r\n\t\t\t\r\n\t\t//construct UI\r\n\t\tWindow.add(Ti.UI.createLabel({text: 'i am the modal window without style, I do not eat memory because I dont have a modalStyle defined, so even a memory warning doesnt cause me to hold onto TiUIiPhoneProxy'}));\r\n\t\t\r\n\t\tvar closeNavBtn = Ti.UI.createButton({title : 'close'});\r\n\t\tcloseNavBtn.addEventListener('click',function(){\r\n\t\t\tWindow.leftNavButton = null;\r\n\t\t\tcloseNavBtn = null;\r\n\t\t\tWindow.close();\r\n\t\t\tWindow = null;\r\n\t\t});\r\n\t\tWindow.leftNavButton = closeNavBtn;\r\n\t\t\r\n\t\t\r\n\t\tWindow.open({\r\n\t\t\tmodal: true\r\n\t\t});\r\n\t});\r\n\tself.add(modalLaunchButtonWithoutStyle);\r\n\tself.open();\r\n\t\r\n})();\r\n\r\n{code}\r\n\r\nh2. Logs\r\n\r\n{code:lang=none|title=console}\r\nI don't know how to provide a useful log of this (Instruments maybe?)\r\n{code}\r\n\r\nh2. Steps to reproduce\r\nSee comment in example code. Run Instruments with the Allocations report, open and close the modal a few times, note that everything cleans up. Now, trigger a memory warning, open and close the modal,note that the TiUIiPhoneProxy doesnt go away. For every memory warning+open/close cycle you run, another object stays living. Use the second button and note that even with memory warnings, things clean up properly.\r\n\r\nh2. Discussions\r\n\r\nA Q&A has not been created for this item, as it's just an incorrect behavior report.", "attachment": [], "flagged": false, "summary": "iOS: Modals created with formsheet style leak a TiUIiPhoneProxy object", "creator": { "name": "wgogan", "key": "wgogan", "displayName": "William G", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "wgogan", "key": "wgogan", "displayName": "William G", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium Studio build 3.0.2.201302191606\r\nTi API build 3.1.0.v20130405170202\r\niOS 6.1 - iPad", "comment": { "comments": [ { "id": "248456", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested on iOS 6 iPad simulator and device with Ti SDK 3.1 GA.\n\nThe TiUIiPhoneProxy object is *always* left behind after showing the modal window with style, regardless of triggering a memory warning simulation. Performing subsequent memory warning simulations doesn't accumulate any further objects.\n\nThe modal window without style never creates the TiUIiPhoneProxy object.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-19T23:05:43.000+0000", "updated": "2013-04-19T23:05:43.000+0000" }, { "id": "421706", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Cannot reproduce with {{Ti.UI.iOS.NavigationWindow}} these days.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-06-11T17:41:37.000+0000", "updated": "2017-06-11T17:41:37.000+0000" }, { "id": "421827", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket with reference to the above comment.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-12T22:33:31.000+0000", "updated": "2017-06-12T22:33:31.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }