{ "id": "103113", "key": "TIMOB-11378", "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": [ { "id": "14169", "description": "2012 Sprint 22 Core", "name": "2012 Sprint 22 Core", "archived": true, "released": true, "releaseDate": "2012-11-05" }, { "id": "14274", "description": "2012 Sprint 22", "name": "2012 Sprint 22", "archived": true, "released": true, "releaseDate": "2012-11-05" } ], "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2012-10-31T10:16:45.000+0000", "created": "2012-10-11T10:52:19.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "core", "notable", "triage" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "30346", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "116893", "key": "TIMOB-14490", "fields": { "summary": "iOS: iPad popover view memory leak when opening/closing popover", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-07-23T05:07:51.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": "h1. Problem description\r\nIt looks like ButtonBar use makes the app running slower as with the time.\r\n\r\nh1. Steps to reproduce\r\n- Use the following single-file sample to see the issue\r\n- Run the app and see the console\r\n- Click the button many times (I tested 100) and see how the opening takes more and more time\r\n- Change ENABLE_BUTTON_BAR to false to disable all the button bar items in the app and repeat the test: now the loading takes always the same time\r\n\r\n{code}\r\nvar ENABLE_BUTTON_BAR = true;\r\n\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\nvar baseWindow = Titanium.UI.createWindow({backgroundColor:'#ffffff'});\r\n\r\nvar searchWindow = Ti.UI.createWindow({title:'Search', backgroundColor:'#ffffff'});\r\nvar navGroup = Ti.UI.iPhone.createNavigationGroup({window:searchWindow});\r\n\r\nbaseWindow.add(navGroup);\r\n\r\nbaseWindow.open();\r\n\r\nvar button = Ti.UI.createButton({\r\n title: 'Start test'\r\n});\r\nbutton.addEventListener('click', openDocument);\r\nsearchWindow.add(button);\r\n\r\nvar counter = 0;\r\nfunction openDocument(){\r\n var startTime = new Date().getTime();\r\n var documentWindow = Ti.UI.createWindow({title:'Document', backgroundColor:'#ffffff'});\r\n \r\n var dir = Ti.Filesystem.resourcesDirectory + Ti.Filesystem.separator;\r\n \r\n if(ENABLE_BUTTON_BAR) { \r\n var buttonBar = Titanium.UI.createButtonBar({\r\n labels: ['One', 'Two', 'Three'],\r\n style:Titanium.UI.iPhone.SystemButtonStyle.BAR,\r\n });\r\n \r\n documentWindow.rightNavButton = buttonBar;\r\n }\r\n \r\n mainView = Titanium.UI.createView({backgroundColor: '#eaeaea', bottom:44});\r\n documentWindow.add(mainView);\r\n \r\n fileView = Ti.UI.createWebView({\r\n bottom:0,\r\n left:0,\r\n right:0,\r\n top:0,\r\n visible:false\r\n });\r\n \r\n mainView.add(fileView); \r\n \r\n if(ENABLE_BUTTON_BAR) {\r\n lastSyncButton = Titanium.UI.createButtonBar({\r\n labels: ['Loading...'],\r\n style:Titanium.UI.iPhone.SystemButtonStyle.BAR,\r\n backgroundColor:'#35850C',\r\n touchEnabled: false,\r\n width:220\r\n });\r\n \r\n lastSyncButton.addEventListener('click', syncButtonEvent);\r\n function syncButtonEvent(e) {}\r\n \r\n favouriteButton = Titanium.UI.createButtonBar({\r\n labels: [{width: 200, title:'Favourite'}],\r\n style:Titanium.UI.iPhone.SystemButtonStyle.BAR,\r\n backgroundColor:'#795ca2'\r\n });\r\n \r\n favouriteButton.addEventListener('click', favouriteButtonEvent);\r\n function favouriteButtonEvent(e){}\r\n \r\n acknowlegeButton = Titanium.UI.createButtonBar({\r\n labels: [{width: 200, title: 'Acknowledge'}],\r\n style:Titanium.UI.iPhone.SystemButtonStyle.BAR,\r\n backgroundColor:'#ED5555'\r\n });\r\n \r\n acknowlegeButton.addEventListener('click', acknowledgeButtonEvent);\r\n \r\n function acknowledgeButtonEvent(e){}\r\n \r\n bottomToolbar = Titanium.UI.iOS.createToolbar({bottom:0, borderTop:true, borderBottom:false, barColor:'#795ca2'});\r\n documentWindow.add(bottomToolbar);\r\n }\r\n \r\n documentWindow.addEventListener('open', function(){\r\n mainView.show();\r\n fileView.show();\r\n \r\n if(ENABLE_BUTTON_BAR) {\r\n var flexSpace = Titanium.UI.createButton({systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE});\r\n bottomToolbar.items = [flexSpace, lastSyncButton, flexSpace, favouriteButton, flexSpace, acknowlegeButton, flexSpace];\r\n }\r\n \r\n var endTime = new Date().getTime();\r\n var timeTaken = (endTime - startTime );\r\n Ti.API.info(counter + ' - Open Document: '+timeTaken + 'ms');\r\n counter++;\r\n \r\n setTimeout(function() {\r\n navGroup.close(documentWindow);\r\n }, 200);\r\n });\r\n \r\n documentWindow.addEventListener('close', function(){\r\n fileView = null;\r\n \r\n if(ENABLE_BUTTON_BAR) {\r\n bottomToolbar.items = [];\r\n bottomToolbar = null;\r\n \r\n lastSyncButton.removeEventListener('click', syncButtonEvent);\r\n favouriteButton.removeEventListener('click', favouriteButtonEvent);\r\n acknowlegeButton.removeEventListener('click', acknowledgeButtonEvent);\r\n \r\n flexSpace = null;\r\n lastSyncButton = null;\r\n favouriteButton = null;\r\n acknowlegeButton = null;\r\n \r\n documentWindow.rightNavButton = null;\r\n buttonBar = null;\r\n }\r\n });\r\n \r\n navGroup.open(documentWindow);\r\n}\r\n{code}\r\n\r\nh1. My results\r\nFirst time the window is open (counter=0), it takes a bit longer, but then it runs smoothly. This test was performed on the iPad simulator with iOS 6 on a MacBook Pro. On the device, the issue seems to be even more visible.\r\n\r\n{code}\r\nvar ENABLE_BUTTON_BAR = false;\r\n\r\n[INFO] 0 - Open Document: 405ms\r\n[INFO] 1 - Open Document: 357ms\r\n[INFO] 2 - Open Document: 356ms\r\n...\r\n[INFO] 98 - Open Document: 355ms\r\n[INFO] 99 - Open Document: 356ms\r\n[INFO] 100 - Open Document: 356ms\r\n{code}\r\n\r\n{code}\r\nvar ENABLE_BUTTON_BAR = true;\r\n\r\n[INFO] 0 - Open Document: 386ms\r\n[INFO] 1 - Open Document: 363ms\r\n[INFO] 2 - Open Document: 362ms\r\n...\r\n[INFO] 98 - Open Document: 476ms\r\n[INFO] 99 - Open Document: 477ms\r\n[INFO] 100 - Open Document: 479ms\r\n{code}\r\n\r\nh1. Note\r\nThe bug comes from a customer, which has a document viewer app that uses a few ButtonBars; opening documents becomes slower and slower, but if the ButtonBars are removed, everything runs normally.\r\n\r\nNote that in the sample the new window is open and closed automatically, to make test easier; the original app of course doesn't have this behavior, but the problem remains.", "attachment": [], "flagged": false, "summary": "iOS: ButtonBar makes the app slower", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "SDK 3.0\r\niOS 6", "comment": { "comments": [ { "id": "223079", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Is the customer truly using SDK 3.0.0? Does it happen with SDK 2.1.3?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-11T16:14:46.000+0000", "updated": "2012-10-11T16:14:46.000+0000" }, { "id": "223084", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yes, also with 2.1.3", "updateAuthor": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-10-11T16:24:38.000+0000", "updated": "2012-10-11T16:24:38.000+0000" }, { "id": "224987", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending https://github.com/appcelerator/titanium_mobile/pull/3329\r\nClosed this PR. Does not solve the issue.", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-25T20:43:56.000+0000", "updated": "2012-10-26T21:57:07.000+0000" }, { "id": "225465", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The problem is caused by leaking CGImage/UiResizableImage.\r\nReproducible in a native app.\r\n{code}\r\nsegmentedControl=[[UISegmentedControl alloc] initWithFrame:rect];\r\n[segmentedControl setSegmentedControlStyle:UISegmentedControlStyleBar];\r\n[segmentedControl setTintColor:[UIColor redColor]];\r\n[segmentedControl insertSegmentWithTitle:@\"Button 1\" atIndex:0 animated:NO];\r\n[segmentedControl insertSegmentWithTitle:@\"Button 2\" atIndex:1 animated:NO];\r\n{code}\r\n\r\niOS6 only.\r\nThe issue is reported to Apple Bug Reporter - http://openradar.appspot.com/radar?id=2222401", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-30T00:18:34.000+0000", "updated": "2012-10-30T04:08:57.000+0000" }, { "id": "225514", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "@Davide.\nsetting backgroundColor on buttonBar sets tint color on the segmented control", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-30T14:34:34.000+0000", "updated": "2012-10-30T14:34:34.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }