Android_ understanding of Android virtual machines, including memory management mechanism garbage collection mechanism. Dalvik and Art differences

Source: Internet
Author: User

Virtual machine is small, space is small, talk about the size of the mobile device virtual machine limit 16M,
Talk about how to deal with big pictures when loading pictures,
Outmemoryexception
Bitmapfactory.option
Garbage collection, without reference to the object, at some point will be the system GC off.

Dalvik and Standard JavaVirtual machines(JVM) The first difference
The Dalvik is based on a register, and the JVM is stack-based.
Register-based VMS are less time-consuming when they are executed, for programs that become larger after compilation.
the difference between Dalvik and the Java operating environment
1:dalvik mainly includes the completion of object lifecycle management, stack management, thread management, security and exception management, as well as garbage collection and other important functions.
2:dalvik is responsible for process isolation and thread management, and each Android application will have a standalone Dalvik virtual machine instance at the bottom, and its code can be executed under the virtual machine interpretation.
3: Unlike Java Virtual machine running Java bytecode, Dalvik virtual machine is running its proprietary file format Dex
The 4:dex file format reduces the overall file size and improves the class lookup speed of I/O operations.
The 5:odex is designed to further improve performance during operation and further optimize the Dex file.
6: All Android apps have threads that correspond to a Linux thread, so virtual machines can rely more on the operating system's thread scheduling and management mechanisms
7: There is a special virtual machine process zygote, which is an incubator of virtual machine instances. It will be generated when the system starts, it will complete the initialization of the virtual machine, library loading, prefabricated class library and initialization operations. If the system needs a new instance of the virtual machine, it will quickly replicate itself and provide the system with the fastest data. For some read-only system libraries, all virtual machine instances share a memory area with zygote.
8:dalvik was written by Dan Bornstein, whose ancestors had lived in a small fishing village named Dalvík, a village in Iceland Eyjafjörður

Many GC implementations leave a small chunk of space at the beginning of the object for GC tagging. Unlike the Dalvik VM, a single space is applied to the GC when it is carried out, and the tag of the object on the entire heap is saved as a bitmap, freeing the space after the GC ends.
Dalvik is the implementation of the time compile + run, the installation is relatively fast, open application is relatively slow, the application occupies a small space art is installed when it is compiled, the implementation of the time directly can be run, installation slow, open application fast, occupy a large space with a metaphor is, riding a bicycle Dalvik is a bicycle that has been folded up, each ride must first assemble a bicycle to ride art is already assembled bicycles, each ride directly to the car can be high efficiency at the time of opening, running speed is similar

The

Android_ understands the Android virtual machine, including the memory management mechanism garbage collection mechanism. Dalvik and Art differences

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.