Android Image Loader Third-party library comparison test

Source: Internet
Author: User

Preheating knowledge

Before testing, we need to understand such a problem

What does the Java heap/native Heap represent?
Whether the Bitmap is allocated on the Java heap or allocated to the native heap
How big is the Java Heap size, and is there a limit?
Native heap size is generally how big, is there a limit?
Java OOM typically occurs when, in relation to the Java heap or with the Native heap

If the above questions are not very clear, you can refer to this link, the basic knowledge of their own evil: Android Process memory management analysis

For some of the above questions, here are a few things to summarize:

Java heap is said for Java Virtual Machine, the general size limit is 16M 24M 48M 76M Specific depending on the phone.
The Native heap is a system heap memory that is directly manipulated by C/s + +, so its upper limit is typically about 2/3 of the specific RAM.
So for 2G phones, Java heap is about 76M, and native heap is about 760M, 10 times times the difference.

So why is Android so stingy that it allocates so little memory to the Java heap?

Since Google has done this, there is a natural reason: this is designed to allow the Android system to allow more processes to reside in memory at the same time, so that the program starts without reloading to memory every time, can give users a faster response. Forcing each application to use a smaller amount of memory, the very limited amount of RAM on the mobile device allows more apps to reside there.

We know that in most Android apps most of the oom happens when loading multiple images, and many people think that bitmap's instance construction is done in the JNI layer, so it should be in the native layer just right, actually not, although in the native layer is completed, However, the instance construction of bitmap is still done through the Android virtual machine environment, so it is still in the Java heap.

Contrast test

The above questions are answered clearly, so let's take a look at some of the more recent image loader libraries

Initialize State

Fresco

Glide

UIL

Volley

Fresco+okhttp

Picasso

Summary

What needs to be said here is that not all of them are static graphs, there are a lot of gif dynamic graphs, so the average load time of the evaluation is less objective, so let's focus on the concepts we mentioned above:

Java Heap and Native heap
From the above test can be seen: Frasco/frasco + OkHttp performance and a few different, the former will dynamically adjust the native heap and basically keep the Java heap stable, the other several are the opposite. The growth of Java heap will directly lead to the advent of oom. So you can be sure that FRASCO can effectively avoid oom, while Frasco can also display dynamic graphs and other features

Based on the above test can be found that the best of the worse, a debate will know.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Image Loader third-party library comparison test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.