android - Huge memory consumption of UniversalImageLoader -


i have problem using universal image loader library. unfortunately, library causes huge memory usage of application.

i have scrollview (there tons of reasons why using scrollview instead of listview, of them have custom insertion , item selection animations) holding 20 custom views. each of custom views consists of textviews imageview.

and here thing:

the images dispalyed in imageviews downloaded internet , have around 100-150kb (dimension 640 x 320) each. if download images using universalimageloader app crashes outofmemoryexception because uses around 80mb of memory.

if not download images, , put in hard-coded image size of 1200kb (dimension 1920 x 1080) per custom view, app consumes around 40mb of memory.

what doing wrong using universalimageloader when downloading ten times smaller images causes app use twice memory?

i disabled caching mechanisms problem still persists.

here universalimageloader setup:

imageloaderconfiguration config = new imageloaderconfiguration.builder(c)         .build();  imageloader.getinstance().init(config);  displayimageoptions options = new displayimageoptions.builder()         .showstubimage(r.drawable.loading)         .showimageforemptyuri(r.drawable.loading)         .showimageonfail(r.drawable.loading)         .cacheinmemory(false)         .cacheondisc(false)         .imagescaletype(imagescaletype.in_sample_int) // default         .build(); 

and in code, call this:

imageloader im = imageloader.getinstance(); im.displayimage("myurl", myimageview, options); 

what doing wrong? why universalimageloader using memory?

for other people out there having same issues:

i managed minimize memory usage , rid of outofmemoryexception following these guidelines:

https://github.com/nostra13/android-universal-image-loader#useful-info

the important part me reduce threadpoolsize down 2. i not feel performance changes after setting down.

imageloaderconfiguration config = new imageloaderconfiguration.builder(c) .threadpoolsize(2)  .build();  displayimageoptions options = new displayimageoptions.builder()  // other options  .bitmapconfig(bitmap.config.rgb_565) .imagescaletype(imagescaletype.exactly)  // other options .build(); 

this reduced applications total memory consumption 35%.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -