Boot images loading (boot.oat, boot.art)
When Android boots up, it loads some boot images
which contain some frequently used classes. In particular boot.oat
contains the code of the classes, and boot.art
some pre-initialized heap.
This speedups application launch, and saves some memory due to the paging mechanism. (More details here)
Zygote preloading
In ZygoteInit.java, there is a preload function.
It preloads classes, resources, shared libraries, etc.
preloadClasses
in particular loads the classes found in:
/system/etc/preloaded-classes
. Which basically causes the static initializers of these classes run.
How they differ?
What is the difference between the two?
Isn't the sole purpose of boot.art
to avoid the explicit initialization that is done by zygotes
preload`?
Shouldn't the zygote's preload
run only for imageless
bootup?