loopj / android-smart-image-view

Android ImageView replacement which allows image loading from URLs or contact address book, with caching
http://loopj.com/android-smart-image-view/
1.29k stars 510 forks source link

Out of Memory Error #12

Open rhychel opened 11 years ago

rhychel commented 11 years ago

Have you tried it using inside an adapter for listview? It seems that your code is not optimized for loading a lot bitmaps. You may decode the result bitmap from the available Heap memory allocated for the app.

ipeisong commented 11 years ago

I think should change memory cache to recommended LruCache class. From Google:

In the past, a popular memory cache implementation was a SoftReference or WeakReference bitmap cache, however this is not recommended. Starting from Android 2.3 (API Level 9) the garbage collector is more aggressive with collecting soft/weak references which makes them fairly ineffective. In addition, prior to Android 3.0 (API Level 11), the backing data of a bitmap was stored in native memory which is not released in a predictable manner, potentially causing an application to briefly exceed its memory limits and crash.