Adding Multiple Markers causes the application to crash

  • Replies:0
Harmeet Singh
  • Forum posts: 1

Jun 15, 2016, 6:36:10 PM via Website

Currently I am using
map.addMarker(new MarkerOptions()
.position(new LatLng(v.latitude, v.longitude))
.title(v.name)
.anchor(0.5f,0.5f)
.snippet(v.address)
.icon(BitmapDescriptorFactory.fromBitmap(bitmap)));
to add markers(bitmaps) on the map.
After using endless adapter and adding upto 200 markers it crashes giving the following message:

Failed to execute task.
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available
at java.util.concurrent.FutureTask.report(FutureTask.java:93)
at java.util.concurrent.FutureTask.get(FutureTask.java:177)
at com.crashlytics.android.core.CrashlyticsExecutorServiceWrapper.executeSyncLoggingException(CrashlyticsExecutorServiceWrapper.java:44)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:235)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
Caused by: java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available
06-15 11:34:08.244 7794-7794/com.neudocs.spiritstexas E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.neudocs.spiritstexas, PID: 7794
java.lang.OutOfMemoryError: Failed to allocate a 46668 byte allocation with 34718 free bytes and 33KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCopy(Native Method)
at android.graphics.Bitmap.copy(Bitmap.java:583)

Reply