2

using Xcode 6.0 and iOS 8.4 and what i have tried is:

-(void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    mapView.mapType = MKMapTypeHybrid;
    mapView.mapType = MKMapTypeStandard;
    mapView.showsUserLocation = NO;
    mapView.delegate = nil;
    [mapView removeFromSuperview];
    mapView = nil;
}

I am using ARC, it not releasing memory when View Disappears.

Sujay
  • 2,510
  • 2
  • 27
  • 47
Ronak Chaniyara
  • 5,335
  • 3
  • 24
  • 51
  • How have you verified that it is the map which is consuming memory? – Avi Nov 18 '15 at 10:18
  • I also experienced this behavior but I dont think it is a bug. Have you tried adding the map and remove it again some times? Does the memory increase with every add and remove? In my app this is not the case. I agree that some MBs are allocated the first time the map is shown and they remain allocated if I look at the memory usage but it is stable even if I show the map view several times. So it shouldnt be a leak I think. I guess this is just because MapKit is lazily loaded. – Philipp Otto Nov 18 '15 at 10:34
  • Yes, Mapview not releasing its memory. Any help would be great. – Ronak Chaniyara Nov 18 '15 at 10:35

1 Answers1

0

Have you tired making MapView or the view controller to be a weak reference?

e.g.: If you're pushing to a view controller with a Map view. Assign it to a weak property.

@property (weak,nonatomic) UIViewController *mapViewController;

rajeeva9
  • 139
  • 12