Outofmemeoryerror (viewpager + imageviews)

后端 未结 6 877
悲哀的现实
悲哀的现实 2021-01-30 12:18

i am showing 150+ images in viewpager, when page size crossed 70 app is crashing , all images are loading from network , and i have fallowed [link]: Strange out of memory issue

6条回答
  •  心在旅途
    2021-01-30 12:37

    I think this happens because you have a memory leak, double check your variables, don't use static vars for anything big, use final when possible, make all members private.

    i suggest you make a commit (or save your current code) and then try to do what i asked and see if it fixes it.

    a code sample would let me tell you if you have memory leaks, maybe you can post the code somewhere like on github or google code

    Bottom line: you could be doing everything right but a variable still holds a reference to your images so the garbage collector can't touch them.

    I know saying you have a memory leak hurts but please don't be alarmed this happens to the best of the best, because it's so easy to happen.

    NOTE: No matter how big the data i load from network apps never needed more than the size of 1 file if handled correctly.

    Thanks

提交回复
热议问题