Exception from memory using android google maps v2

When I add and remove markers on the map, after a while the application crashes due to an exception from memory.

logcat answer:

02-21 06:04:27.670: E/AndroidRuntime(1892): FATAL EXCEPTION: vts_com.rapidBizApps.mapamine
02-21 06:04:27.670: E/AndroidRuntime(1892): java.lang.OutOfMemoryError
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.bb.d.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.s.ap.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.ak.r.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.ak.e.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.ak.e.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.ak.o.handleMessage(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at android.os.Looper.loop(Looper.java:130)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.ak.e.j_(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.ak.ad.j_(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.bb.l.b(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892):     at maps.bb.l.run(Unknown Source)
02-21 06:04:33.260: D/dalvikvm(1892): GC_EXPLICIT freed 2148K, 53% free 5309K/11207K, external 21007K/21768K, paused 71ms

my code is:

loop 20 times:


    mapView.addMarker(new MarkerOptions()
                                        .position(new LatLng(latitude, longitude))
                                        .icon(BitmapDescriptorFactory
                                                .fromBitmap((bitmap)))
                                        .snippet(text + "             ")
                                        .title(mine_name));

For each new cycle, I delete the markers on the map and add new ones.

I also really cared about bitmap like

bitmap.recycle and assign a bitmap with a zero value after using the bitmap /

+5
source share
2 answers

There are some problems with this google api. We must wait for the next release .... BitmapDescriptorFactory has a memory leak.

http://code.google.com/p/gmaps-api-issues/issues/detail?id=4766&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal

25 13, . google!

+5

Google map v2. 30 . , , mMap.clear();, mMap - GoogleMap.

for.

, .

+1

All Articles