Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

OutOfMemoryError in sample #16

Open
sealskej opened this Issue · 1 comment

2 participants

@sealskej

Using GridViewActivity in sample I get OutOfMemoryError on Android x86 2.3.3 emulator.

03-14 02:38:35.933: ERROR/AndroidRuntime(1322): FATAL EXCEPTION: AsyncTask #7
        java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:200)
        at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
        at java.lang.Thread.run(Thread.java:1019)
        Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
        at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
        at uk.co.senab.bitmapcache.BitmapLruCache.getFromDiskCache(BitmapLruCache.java:262)
        at uk.co.senab.bitmapcache.BitmapLruCache.get(BitmapLruCache.java:233)
        at uk.co.senab.bitmapcache.samples.NetworkedCacheableImageView$ImageUrlAsyncTask.doInBackground(NetworkedCacheableImageView.java:81)
        at uk.co.senab.bitmapcache.samples.NetworkedCacheableImageView$ImageUrlAsyncTask.doInBackground(NetworkedCacheableImageView.java:54)
        at android.os.AsyncTask$2.call(AsyncTask.java:185)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
        ... 4 more
@warenix

I met OOM on gridview when the images are quite large (e.g. http://www.hdwallpapers.in/walls/cute_baby_colors-wide.jpg).
If you trace the code from this method: uk.co.senab.bitmapcache.NetworkedCacheableImageView.loadImage(String, boolean)
The passed decodeOpts doesn't honor BitmapFactory.Options.inSampleSize which is very useful to prevent OOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.