DEPRECATED-mapbox-ios-sdk icon indicating copy to clipboard operation
DEPRECATED-mapbox-ios-sdk copied to clipboard

Possibly some memory issues

Open ilmarion opened this issue 12 years ago • 7 comments

Hello. I've found some places in MapBox sources (ver. 1.0.1) which probably can cause memory problems.

  1. RMMapView, _delegate ivar is __strong so retain cycle is possible.
  2. RMMapView, _viewControllerPresentingAttribution is __strong. So if _hideAttribution == NO and RMMapView instance is held by UIViewController then retain cycle will occur because this UIViewController will be stored in _viewControllerPresentingAttribution.
  3. RMMemoryCache, _memoryCacheQueue is created but never released.
  4. RMTileCache, _tileCacheQueue is created but never released.
  5. RMQuadTree (and all its nodes) holds strong reference to the RMMapView so retain cycles are possible.
  6. RMQuadTreeNode, parentNode property is strong so retain cycles between nodes are possible.

ilmarion avatar Mar 27 '13 10:03 ilmarion

Thanks for these reports. I will investigate. Most of this comes down from https://github.com/Alpstein/route-me FWIW.

incanus avatar Mar 27 '13 19:03 incanus

I have problems with retain cycles when pushing and popping controller with RMMapView. When is it planned to fix this issues?

vzqwer avatar Dec 06 '13 13:12 vzqwer

Ditto--would like to see these issues fixed ASAP. It's making me hesitant to use the SDK in my shipping app. It's probably not an issue in most map-based apps because only a single map is created during the app lifecycle, but in my case i need to instantiate several map views depending on user demand.

jrmatchett avatar Feb 03 '14 23:02 jrmatchett

Many of these have been fixed as of 4f1fc00d73f82eac8f83da9d80c68a91c4f96dd0.

incanus avatar Mar 18 '14 16:03 incanus

@ilmarion Would be interested in submitting a pull request if you are still seeing any of these?

incanus avatar Aug 26 '14 23:08 incanus

@incanus After a brief look into the current code It seems that issues 1, 2 and 5 are resolved. But 3, 4 and 6 are probably still there. I will try to find some time to investigate them more deeply.

ilmarion avatar Sep 01 '14 18:09 ilmarion

Mm mlv

Am Montag, 1. September 2014 schrieb ilmarion :

@incanus https://github.com/incanus After a brief look into the current code It seems that issues 1, 2 and 5 are resolved. But 3, 4 and 6 are probably still there. I will try to find some time to investigate them more deeply.

— Reply to this email directly or view it on GitHub https://github.com/mapbox/mapbox-ios-sdk/issues/221#issuecomment-54083310 .

jvieten avatar Sep 02 '14 07:09 jvieten