Code Monkey home page Code Monkey logo

Comments (9)

thest1 avatar thest1 commented on August 21, 2024

Sorry for a delay, too busy these days.
If you get OOM probably you do something wrong. Please check what's the
difference between your implementation and my sample.
Actually you should not call recycle because bitmaps are cache in memory.
If you don't cache them the scroll will be too slow. They're cache in
memory for some time and removed from memory when we don't need them. I use
this approach in many applications using a lot of bitmaps, work just fine.
OOM issues are very rare for me.

2012/10/4 shaunidiot [email protected]

Please forgive me for my noob-ness in Android programming. Just learnt
Java weeks ago.

I've been using Lazylist to load images from website. However, I've been
getting OOM error.
I searched it up on Stackoverflow and realized that recycle is needed so
that space can be allocated for more images.
I looked it up on ImageLoader and this (recycle) wasn't implemented. I
tried to code it myself yet faced with lots of error [bitmap.recycle()].
May I ask if this is possible?
Furthermore, in the listview, one image doesn't cause an error, yet when I
add textview etc, it caused the OOM error too.
Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/20.

from lazylist.

DeLL116 avatar DeLL116 commented on August 21, 2024

I was having the same issues, specifically on the Motorola DroidX2 which has a 32mb heap limit AND is running Gingerbread......however....

I changed the Map instance of the cache object in the MemoryClass.java file to use a SoftReference to bitmaps like so:

private Map<String, SoftReference<Bitmap>> cache=Collections.synchronizedMap(
        new LinkedHashMap<String, SoftReference<Bitmap>>(10,1.5f,true));

Now I'm able to load up over 300 images all of great quality.

Obviously all calls to get() and put() needed to be modified to account for the change to SoftReference, but it's working great now.

I'm a noob, so if I'm dead wrong on this my apologies, but I thought I should let you know of my findings just in case it could help others.

Thank you for this library! It's awesome!

  • Chris

from lazylist.

thest1 avatar thest1 commented on August 21, 2024

SoftReferences are not recommended to be used on Android. They may be cleared too fast and you'll get no cache at all, image will be parsed from SD each time. I had this problem before that's why I switched to my own MemoryCache implementation.

By default MemoryCache uses 25% of available memory. You can try to use less to have more free memory.

from lazylist.

asiri-07 avatar asiri-07 commented on August 21, 2024

Dear thest1,
first, thanks for the awesome library. However, I am facing the same issues as DeLL116 and the first guy.
Could you pl ease re-check your approach for memory leakages with some heavy loading ?

from lazylist.

ankit662003 avatar ankit662003 commented on August 21, 2024

hi @thest1 this is my app,it's work in progress and i am unsure if this is the way lazyload performs
please have a look at the app,it's only 1 mb
https://www.dropbox.com/s/anijtvbs4gp012t/PlayMee.apk

you will really like the app and i will mention your name on my company's website
i am 20 yrs old and I am a student ,so please help me out,I am not having errors but I think lazy load isn't performing to its potential...i tried saving memory by using weak references/soft references until i came across your answers,please help me out with this one.
I have used view holder pattern to increase the performance by not intializing the views again and again,it did help me to some extent but it did't solve the laggy scroll issue
I know you are busy and all but I think I really may need your help on this one as I am just 20yrs old and may need some guidance.
If you have decided to help me
here is the code you may need to look

https://www.dropbox.com/s/t7uoudwq30i58kx/LazyList.rar

I have a website under construction
www.playmee.org and i will mention your name there,if you would like
please help me out on this one,thanx

from lazylist.

thest1 avatar thest1 commented on August 21, 2024

Laggy scroll usually means you're inflating new view in every getView() call or decode bitmap in every getVIew() call. Please investigate what exactly is happening when you scroll.

from lazylist.

vnju avatar vnju commented on August 21, 2024

Dear thest1
You're a cool man. Your project's really helpful for everyone. However, I also met a memory issue that
I used youtube user feed Project at https://github.com/coolbong/android-youtubeplayer, when i ran, it only shows around 30 images on listview. When i did ClearCache and pull to refresh, It can show more, but above images were disappeared
Could plz help me
Thanks alot

from lazylist.

vnju avatar vnju commented on August 21, 2024

I used SoftReference and everything's ok now. However, I want to get the solution from Thest1
thanks

from lazylist.

d7coders avatar d7coders commented on August 21, 2024

I have the same issue,
any solution ?

from lazylist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.