ART Runtime Quiz

ANDROID › System

Which statement best describes how ART replaced Dalvik in terms of code execution?

Answer: ART runs the same DEX bytecode but adds AOT compilation with JIT and interpretation

ART and Dalvik both execute DEX bytecode; ART's key addition was ahead-of-time compilation via dex2oat, layered with JIT and interpretation.

On Android 7+ with profile-guided compilation, when does dex2oat typically AOT-compile an app's hot methods?

Answer: In the background when idle and charging, using the profile

Post-Android 7 ART installs apps quickly, profiles hot methods at runtime, and compiles them during idle/charging background dexopt rather than at install time.

What is the primary startup benefit of shipping a Baseline Profile?

Answer: Critical startup methods are AOT-compiled at install time.

A Baseline Profile tells ART which methods to AOT-compile at install, so hot startup paths run as compiled code immediately, cutting cold start by roughly 30%.

How do Cloud Profiles differ from Baseline Profiles?

Answer: Cloud Profiles are Play-aggregated from usage; Baseline Profiles apply at install

Cloud Profiles are crowd-sourced from real usage (Android 9+) and delivered hours-to-days later; Baseline Profiles are bundled in the APK/AAB and take effect immediately at install.

What is the 64K limit that multidex addresses?

Answer: A maximum of 65,536 method references in one DEX file

A single DEX file can address at most 65,536 method references; multidex splits the app across multiple DEX files to exceed it (automatic for minSdk 21+).

Which is an accurate description of ART's garbage collection?

Answer: Mostly concurrent, with one short pause independent of heap size

ART uses a mostly-concurrent collector with typically a single short pause and concurrent copying, and the pause length does not grow with heap size.

Why does AOT-compiled code generally outperform interpreted or freshly-JITed code at startup?

Answer: Because native code is already in an OAT file and runs with no JIT warmup

dex2oat produces native machine code stored in an OAT binary that the CPU runs directly, avoiding the interpreter's per-instruction overhead and the runtime warmup cost of JIT compilation.

In the Android build pipeline, what is the difference between D8 and R8?

Answer: D8 compiles .class bytecode to DEX; R8 also shrinks, optimizes, obfuscates

D8 is the dexer that turns compiled .class bytecode into DEX; R8 is the superset tool that also performs tree-shaking, optimization, and obfuscation while emitting DEX, replacing the old ProGuard plus D8 flow.

How does Android typically launch a new app process to cut startup cost and memory use?

Answer: The Zygote preloads framework classes, then forks apps that share memory copy-on-write

Android forks app processes from the Zygote, which has preloaded and initialized common framework classes and resources, so forked apps start faster and share that memory via copy-on-write.

Since Android 12, how is the ART runtime itself updated on supported devices?

Answer: As an updatable Mainline module (com.android.art APEX) shipped via Play updates

ART became an updatable Mainline module packaged as the com.android.art APEX, so runtime and compiler fixes ship via Google Play system updates independently of full OS releases.

What does ART's default 'speed-profile' compilation filter do during background dexopt?

Answer: AOT-compiles only methods in the app's profile, leaving the rest

speed-profile is profile-guided: dex2oat AOT-compiles the methods recorded in the profile and leaves cold code to run interpreted or JIT-compiled, balancing compile time, storage, and runtime speed.

Why do apps that ship a Baseline Profile usually also include the androidx.profileinstaller library?

Answer: It writes the bundled baseline profile into ART's profile store for AOT compilation

ProfileInstaller copies the app's bundled baseline.prof into the location ART reads, ensuring the profiled methods are actually picked up and AOT-compiled rather than ignored on devices that would not install it automatically.

What GC improvement did Android 10 add to ART's concurrent copying collector?

Answer: A generational mode that collects young, short-lived objects more often and cheaply

Android 10 introduced generational concurrent copying, letting ART collect the young generation of short-lived objects more often and cheaply, which reduces overall GC cost and improves throughput.

What happens when an app's heap usage exceeds the per-app heap limit ART enforces?

Answer: It throws OutOfMemoryError even on high-RAM devices unless android:largeHeap is set

ART caps each app's heap at a device-defined limit regardless of total RAM, so crossing it raises OutOfMemoryError; android:largeHeap can request a bigger cap but is discouraged and not guaranteed.

Back to ART Runtime