{ "id": "114897", "key": "TIMOB-14103", "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": "15703", "description": "2013 Sprint 22", "name": "2013 Sprint 22", "archived": true, "released": true, "releaseDate": "2013-11-01" }, { "id": "15704", "description": "2013 Sprint 22 API", "name": "2013 Sprint 22 API", "archived": true, "released": true, "releaseDate": "2013-11-01" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-10-22T22:33:39.000+0000", "created": "2013-05-24T06:16:01.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ios", "leak", "mapView", "memory", "routes" ], "versions": [], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2013-10-24T00:11:52.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": "*Problem*\r\nFrom what I can see removeRoute() does not properly release the memory created. I have taken a deep dive into how it handles the MKPolyline and MKPolylineView objects that are created - one of each per call to addRoute() in a mapView. As soon as the route is deleted the MKPolyline object is released, but the MKPolylineView object is not. (I used Instruments for this check).\r\n\r\n*Test Case*\r\n\r\n{code}\r\nvar ppt = 1; // Change here if you want to try adding multiple routes per button press\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar addButton = Ti.UI.createButton({title: \"Add \" + ppt, left:0, top: 0});\r\naddButton.addEventListener(\"click\", AddRoutes);\r\n\r\nvar deleteButton = Ti.UI.createButton({title: \"Delete all\", right: 0, top: 0});\r\ndeleteButton.addEventListener(\"click\", DeleteRoutes);\r\n\r\nvar map = Ti.Map.createView({\r\n\ttop: 50\r\n});\r\nwin.add(map);\r\n\r\nwin.open();\r\n\r\nwin.add(addButton);\r\nwin.add(deleteButton);\r\n\r\nvar routes = [];\r\nvar id = 0;\r\n\r\nfunction AddRoutes() {\r\n\tfor(var i=0;i 0)\r\n\t\tmap.removeRoute(routes.pop());\r\n}\r\n{code}\r\n\r\n*Actual Results*\r\nWhen analyzing the objects in memory in instruments it is clear that each and everyone of the MKPolyline objects are released, but not a single one of the MKPolylineView objects.\r\n\r\n*Expected Results*\r\nBoth MKPolyline objects and MKPolylineView objects are released.\r\n\r\nIs there is leak here, or have I completely missunderstood how the release of these objects should work?", "attachment": [], "flagged": false, "summary": "iOS: Possible memory leak in add/removeRoute", "creator": { "name": "john_r", "key": "john_r", "displayName": "John Rowtough", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS Simulator, iPhone, Titanium SDK 3.1.0 GA, iOS 6.X", "comment": { "comments": [ { "id": "259122", "author": { "name": "jason919", "key": "jason919", "displayName": "jason hu", "active": true, "timeZone": "America/Chicago" }, "body": "I can confirm this. My app needs to draw many routes on the map, we are struggling with the memory issue now.", "updateAuthor": { "name": "jason919", "key": "jason919", "displayName": "jason hu", "active": true, "timeZone": "America/Chicago" }, "created": "2013-06-24T00:44:27.000+0000", "updated": "2013-06-24T00:44:27.000+0000" }, { "id": "276202", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending against master\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4822", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-22T19:22:52.000+0000", "updated": "2013-10-22T19:22:52.000+0000" }, { "id": "276514", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified both MKPolyline and MKPolylineView objects are released while using Instruments.\n\nTested on:\n\nTitanium Studio, build: 3.2.0.201310230548\nOS: Mac OS X Mountain Lion (10.8.5)\nSDK build: 3.2.0.v20131023140842\nTi CLI: 3.2.0 (72f7426b4ee6c2d2883c666d5b7e03906a16012f)\nXcode: 5.0.1\nDevices: iphone 5 (6.1.3), iphone 5c (7.0.1)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-24T00:11:43.000+0000", "updated": "2013-10-24T00:11:43.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }