{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/7991","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/7991/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/7991/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/7991/events","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/7991","id":206332026,"number":7991,"title":"[IOS] Memory leak","user":{"login":"karlobutorac","id":17730321,"avatar_url":"https://avatars2.githubusercontent.com/u/17730321?v=4","gravatar_id":"","url":"https://api.github.com/users/karlobutorac","html_url":"https://github.com/karlobutorac","followers_url":"https://api.github.com/users/karlobutorac/followers","following_url":"https://api.github.com/users/karlobutorac/following{/other_user}","gists_url":"https://api.github.com/users/karlobutorac/gists{/gist_id}","starred_url":"https://api.github.com/users/karlobutorac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlobutorac/subscriptions","organizations_url":"https://api.github.com/users/karlobutorac/orgs","repos_url":"https://api.github.com/users/karlobutorac/repos","events_url":"https://api.github.com/users/karlobutorac/events{/privacy}","received_events_url":"https://api.github.com/users/karlobutorac/received_events","type":"User","site_admin":false},"labels":[{"id":92400707,"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/iOS","name":"iOS","color":"000000","default":false},{"id":101435202,"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/performance","name":"performance","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-02-08T21:36:26Z","updated_at":"2018-04-24T07:41:01Z","closed_at":"2017-02-09T11:00:25Z","author_association":"NONE","body":"<!--\r\nHello and thanks for contributing! To help us diagnose your problem quickly, please:\r\n\r\n - Include a minimal demonstration of the bug, including code, logs, and screenshots.\r\n - Ensure you can reproduce the bug using the latest release.\r\n - Only post to report a bug or request a feature; direct all other questions to: https://stackoverflow.com/questions/tagged/mapbox\r\n-->\r\n**Platform:** ios\r\n**Mapbox SDK version:**3.4.1\r\n\r\n### Steps to trigger behavior\r\n\r\n 1. Switching between 2 viewControllers in which one is a MGLMapView takes every time about 50-70 mb , resulting in a crash after 6-7 takes. \r\n \r\nI found the same issue here: https://github.com/mapbox/mapbox-gl-native/issues/3130, but it says it's resolved by an update... \r\nI don't know if it matters but I'm using mapView for  offline maps. \r\n\r\nIt is my first time posting anything to github and I'm quite new to swift (and programming) so please if you could explain the solution as best as you can :)\r\n"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/383834886","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/7991#issuecomment-383834886","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/7991","id":383834886,"user":{"login":"rajtharan-g","id":23209069,"avatar_url":"https://avatars0.githubusercontent.com/u/23209069?v=4","gravatar_id":"","url":"https://api.github.com/users/rajtharan-g","html_url":"https://github.com/rajtharan-g","followers_url":"https://api.github.com/users/rajtharan-g/followers","following_url":"https://api.github.com/users/rajtharan-g/following{/other_user}","gists_url":"https://api.github.com/users/rajtharan-g/gists{/gist_id}","starred_url":"https://api.github.com/users/rajtharan-g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajtharan-g/subscriptions","organizations_url":"https://api.github.com/users/rajtharan-g/orgs","repos_url":"https://api.github.com/users/rajtharan-g/repos","events_url":"https://api.github.com/users/rajtharan-g/events{/privacy}","received_events_url":"https://api.github.com/users/rajtharan-g/received_events","type":"User","site_admin":false},"created_at":"2018-04-24T07:41:01Z","updated_at":"2018-04-24T07:41:01Z","author_association":"NONE","body":"The main reason for this memory leak is that the view controller might have not been deallocated.\r\nYou can check whether the view controller where you are using the map box map is properly getting deallocated.\r\n\r\nYou can use the below code in a view controller to know if that has been deallocated when you dismiss/pop a view controller or change a root view controller where you have the map.\r\n    deinit {\r\n        print(\"Memory to be released soon\")\r\n    }\r\n\r\n**SOLUTION:**\r\nIf the above code is not getting called, check for any delegate for which there might be a strong reference. You can fixit by changing that to a weak reference. Checkout \"Bonus: View Controller - weak delegate\" section in https://samwize.com/2016/05/30/finding-retain-cycle-with-instruments/ for more information."}}
{"actor":{"display_login":"rajtharan-g"}}