chrisbanes / Android-BitmapCache

Android-BitmapCache is a specialised cache, for use with Android Bitmap objects.
834 stars 224 forks source link

Frequently getting the error of "java.lang.OutOfMemoryError" exception #33

Open linxingyun opened 11 years ago

linxingyun commented 11 years ago

Hello, I am frequently getting the OOME exception when using this lib to view pictures from server. Here is the exception callback:

07-17 23:00:01.230: E/AndroidRuntime(10272): Caused by: java.lang.OutOfMemoryError 07-17 23:00:01.230: E/AndroidRuntime(10272): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 07-17 23:00:01.230: E/AndroidRuntime(10272): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493) 07-17 23:00:01.230: E/AndroidRuntime(10272): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:299) 07-17 23:00:01.230: E/AndroidRuntime(10272): at uk.co.senab.bitmapcache.BitmapLruCache.put(BitmapLruCache.java:425)

Note that the "mDecodeOpts" is setting as below: if (!fullSize) { decodeOpts = new BitmapFactory.Options(); decodeOpts.inDensity = DisplayMetrics.DENSITY_XHIGH; decodeOpts.inPurgeable = true; decodeOpts.inInputShareable = true; decodeOpts.inScaled = true; }

Thanks in advance for any comment or suggestion!