2

I'm using HERE maps in one of my apps. And I have to show map on at least 3-4 screens. So there will be 3-4 map instances loaded in memory all time.

What I have noticed is that loading one instance of HERE maps consumes up to 50MB of memory. As soon as I move to other screen hence two instances of map are loaded. Memory jumps to 100MB and so on and so forth. Finally after using sometime, the app crashes with memory issue.

"Got memory pressure notification (critical) 2017"

I'm adding purchased version of HERE maps through pods. Does it make any difference?

One more thing that I noticed that every time I change frame of HERE map i.e., increase/ decrease its height, it seems to reload map which again consumes considerable memory.

Any one facing this with HERE maps ios version??

Saira
  • 65
  • 5
  • I am seeing this issue as well. Did you ever find a resolution to this issue? – Jeremy White Apr 03 '18 at 15:37
  • No. I did not find any solution yet. – Saira Apr 05 '18 at 12:07
  • @Saira Did you find any solution? I have also this issue with here map (iOS) SDK. Memory usage: 617MB, Energy Impact: High, If you find any solution please let me know. – Vivek Oct 16 '19 at 09:26
  • No Vivik. Unfortunately I wasn’t able to find any solution to this. – Saira Oct 17 '19 at 20:49
  • @Saira, Please check the below code, I found the solution for release memory pressure in iOS (HereMap), Please let me know this solution is working or not, In my case, this solution is working and release memory around 100MB. – Vivek Nov 08 '19 at 05:23

2 Answers2

1

I found a solution for release memory pressure in iOS (HereMap).

I am using 3 maps (HereMap) screen in my application and this solution works for me and Release memory around 100MB.

You need to init your map in viewDidAppear and remove your map in viewDidDisappear.

I am using 3 map in my application and init view in

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self->mapView == nil) {
            self->mapView = [[NMAMapView alloc] initWithFrame:self.view.frame];
            [self.view addSubview:self->mapView];
            [self.view sendSubviewToBack:self->mapView];
        }
        [self mapSetup];
    });
}


- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [self removeMemoryForMapView];
}


-(void)removeMemoryForMapView {

    mapView.positionIndicator.visible = false;
    mapView.landmarksVisible = false;
    mapView.delegate = nil;
    mapView.gestureDelegate = nil;
    mapView.safetySpotsVisible = false;
    [mapView setVisibility:false forPoiCategory:NMAMapPoiCategoryAll];
    [mapView removeFromSuperview];
    mapView = nil;
}
Vivek
  • 4,916
  • 35
  • 40
0

You didn't write if you are using MapKit or Google Maps SDK for iOS but i am assuming you are using native MapKit. I do not think that it is the map that influence your app size that much because Maps cache is shared. MKMapView has it's own cache that contains recently displayed maps so that when device is offline you can still display last viewed map. You can try clearing cache by using this solution: How can I clear MKMapView's cache of map tiles?

I recommend you creating shared MapViewController that you can embed in all other controllers of your app that need maps.

Mila Meko
  • 22
  • 5
  • No, I am not using Google or Apple Maps. I mentioned in my question that I'm using HERE maps sdk. But may be that was little less evident. I've edited my question to make it more clear. – Saira Nov 02 '17 at 05:28