Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] OutOfMemoryError when adding infowindow as bitmap #14960

Closed
moorthysubu opened this issue Feb 20, 2019 · 2 comments
Closed

[android] OutOfMemoryError when adding infowindow as bitmap #14960

moorthysubu opened this issue Feb 20, 2019 · 2 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@moorthysubu
Copy link

When tried to show Info window by generating a bitmap from view, Android system throws OutOfMemory when tried to loan 100+ marks in a map, Here view includes textView & Multiple Imageview with SVG source, So how to implement info window in symbol layer without using bitmaps or any other approaches to fix OutOfMemory exceptions,Thanks in advance

java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.OutOfMemoryError: Failed to allocate a 289988 byte allocation with 97968 free bytes and 87KB until OOM at java.nio.ByteBuffer.allocate(ByteBuffer.java:56) at com.mapbox.mapboxsdk.maps.NativeMapView$BitmapImageConversionTask.doInBackground(NativeMapView.java:1300) at com.mapbox.mapboxsdk.maps.NativeMapView$BitmapImageConversionTask.doInBackground(NativeMapView.java:1273) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818) 

@moorthysubu moorthysubu changed the title OutOfMemery Exception OutOfMemoryError when adding infowindow as bitmap Feb 20, 2019
@langsmith langsmith transferred this issue from mapbox/mapbox-android-demo Jun 18, 2019
@langsmith langsmith added the Android Mapbox Maps SDK for Android label Jun 18, 2019
@langsmith langsmith changed the title OutOfMemoryError when adding infowindow as bitmap [android] OutOfMemoryError when adding infowindow as bitmap Jun 18, 2019
@tobrun
Copy link
Member

tobrun commented Jun 18, 2019

so how to implement info window in symbol layer without using bitmaps

You can but are limited to the style-spec properties we expose, see https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers-symbol

any other approaches to fix OutOfMemory exceptions

Are you cleaning up your created views and bitmaps? How are you adding these images to your map?
We recently added a new functionality to lazily load images when needed (see PR in #14320).

@tobrun
Copy link
Member

tobrun commented Jun 24, 2019

since their is no follow up from your end and this is an implementation detail on your end.
Going to close for now.

@tobrun tobrun closed this as completed Jun 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

3 participants