Google Maps - Out of memory exception

送分小仙女□ 提交于 2019-12-08 07:40:54

问题


I am using Google Maps v2 and am getting following error:

E/qdmemalloc(17414): ion: Failed to map memory in the client: Out of memory
E/qdgralloc(17414): Could not mmap handle 0x7e55bf40, fd=143 (Out of memory)
E/qdgralloc(17414): gralloc_register_buffer: gralloc_map failed
E/GraphicBuffer(17414): unflatten: registerBuffer failed: Out of memory (-12)

The app doesn't crash yet, but the map isn't shown anymore. When I load the activity that contains the map again, the app shows a warning and crashes with the following error message:

Warning:

<sharedmem_gpumem_alloc_id:1431>: sharedmem_gpumem_alloc:
   mmap failed errno 12 Out of memory

Error:

<ioctl_kgsl_sharedmem_alloc:1532>:
    ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null)

I think the problem might be the usage of custom icons:

googleMap.addMarker(new MarkerOptions()
 .position(chargingStationObject.geoData)
 .title(chargingStationObject.name)
 .snippet(chargingStationObject.stationAvailability)
 .data((chargingStationObject.id))
 .icon(iconDescriptor_gray));

Is there a way t prevent that from happening? Using smaller bitmaps for icons, for example?


回答1:


As as workaround I added largeHeap=true to the AndroidManifest.xml. It seems to be working, I'd like a more elegant solution however.



来源:https://stackoverflow.com/questions/23541378/google-maps-out-of-memory-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!