I have an even more frustrating version of that bug. We use a mapview
that supports rotation and thus is slightly larger than the screen
area.  When users zoom in a few times they can very easily cause the
OOM condition.   I have no control over the way the Google Maps API
works, do I?

By the way, OOM is catchable. Not that it would help much though...

Here's my current code

            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                System.gc();
                try {
                    mMapView.getController().zoomIn();
                } catch (OutOfMemoryError e) {
                    e.printStackTrace();
                }
                System.gc();
                zoomLevel = mMapView.getZoomLevel();
                SharedPreferences.Editor editor = settings.edit();
                editor.putInt("zoomLevel", zoomLevel);
                editor.commit();

            }


On Feb 25, 6:07 pm, String <[email protected]> wrote:
> Sounds to me like you are probably hitting the bitmap deallocation 
> problem:http://code.google.com/p/android/issues/detail?id=8488
>
> In summary, the issue is that bitmap memory takes several GC passes to 
> deallocate, so it's really easy to get ahead of the GC and run out of memory.
>
> AFAIK, there's no fix. You can help the situation somewhat by calling 
> System.gc() after every Bitmap.recycle() call, and again before every bitmap 
> allocation. But that's only somewhat. I've also found that setting bitmap 
> variables to null after recycling them makes matters worse, but YMMV.
>
> String

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to