8

I'm currently using a GMSMapView in my swift app, and the energy impact is never decreasing ( as the CPU usage or Memory usage ).

Did anyone already faced this issue ?

Using Google Maps 2.0.1

Xcode Monitoring

Energy impact

CZ54
  • 5,488
  • 1
  • 24
  • 39

3 Answers3

8

I Found the answer myself. It is related to GMSMarker.tracksViewChanges property.

Turning it to false for all added markers has released the CPU.

CZ54
  • 5,488
  • 1
  • 24
  • 39
2

Make false of GMSMarker()'s object property tracksViewChanges & tracksInfoWindowChanges

let placeMarker = GMSMarker()
placeMarker.tracksViewChanges = false
placeMarker.tracksInfoWindowChanges = false

It will bringdown energy impact clock indictor.

Abhishek Mitra
  • 3,335
  • 4
  • 25
  • 46
  • I was already using tracksViewChanges property but now added tracksInfoWindowChanges as false, and that is showing significant improvement. – prabhu Apr 13 '20 at 11:17
0

I found google maps to consume to much memory as well. Changing tracksViewChanges worked for me as well.

Another approach that I have tried when the rendering was taking to long, is to split the rendering of the markers or views in the map.

You can use the delegate methods of GMSMapView

  • mapViewDidStartTileRendering(_mapView: GMSMapView) and
  • mapViewDidFinishTileRendering(_ mapView: GMSMapView)

to know when the render has finished and add new elements.

sheinix
  • 167
  • 1
  • 13