I am using google map view and adding markers to it using this code:
googleMap.addMarker(new MarkerOptions()
.position(chargingStationObject.geoData)
.title(chargingStationObject.name)
.snippet(chargingStationObject.stationAvailability)
.data((chargingStationObject.id))
.icon(iconDescriptor));
iconDescriptor is created like this:
iconDescriptor = BitmapDescriptorFactory.fromResource(getResources()
.getIdentifier("mapicon", "drawable", getActivity().getPackageName()));
When there are too many markers on my map, the heap is filled to its maximum, and after a while the app crashed with an out-of-memory-exception. This only happens when there are or have been a larger amount of markers on the map. Even after I call .clear(), the heap is still rather large.
Maybe the bitmaps haven't been recycled properly?