I wrote this program to overlap circles to show where I've been using the google maps android api v2. After about 2 hours I get the java.lang.OutOfMemoryError with the heap size being larger than allocated. From stack trace... (Heap Size=98304KB, Allocated=86536KB)
Why does this take up so much memory to store all these overlapping circles?
public void onLocationChanged(Location location) {
CircleOptions circleOptions = new CircleOptions()
.center(new LatLng(location.getLatitude(), location.getLongitude()));
circleOptions.radius(10); // In meters
mMap.addCircle(circleOptions);
}
Any suggestions on how to mitigate this? I would like to keep the circles so it isn't an option to use map.clear(). Also I need to keep using the circles because it allows me to set a path width on the map.