Android Performance & Memory Interview Questions

Jank, leaks, profiling, and startup speed.

50 questions in this topic · 8 sample questions below

Practice Performance & Memory in the quiz engine

Sample questions

  1. Which thread must not perform long-running blocking work in an Android app?

    • The main (UI) thread — correct
    • Any background worker thread
    • The Choreographer's vsync thread only
    • The garbage collector thread

    Why: The main thread handles UI and input, so blocking it causes jank and ANRs; heavy work belongs on background threads. Background workers exist precisely to run such work, and developers do not schedule work on GC or internal vsync threads.

  2. What does the term jank refer to in Android UI performance?

    • Excessive APK size
    • Visible stutter caused by dropped or late frames — correct
    • A type of memory leak
    • A network timeout

    Why: Jank is the visible stutter when frames are dropped or rendered late, missing the frame budget. It is unrelated to APK size, memory leaks, or network timeouts.

  3. Which library is commonly used specifically to detect memory leaks in debug builds?

    • Retrofit
    • Glide
    • LeakCanary — correct
    • WorkManager

    Why: LeakCanary automatically watches for retained objects and reports leak traces in debug builds. Retrofit handles networking, Glide loads images, and WorkManager schedules background work, none of which detect leaks.

  4. What is a cold start?

    • Launching the app when its process is already running
    • Resuming the app from the recent apps list instantly
    • Reinstalling and then opening the app
    • Launching the app when its process must be created from scratch — correct

    Why: A cold start begins with no existing process, so the system must create it and initialize the Application and first Activity. If the process already exists it is a warm or hot start, which is faster.

  5. Which color format uses more memory per pixel for a bitmap?

    • ARGB_8888 — correct
    • RGB_565
    • They are identical in memory
    • ALPHA_8

    Why: ARGB_8888 uses 4 bytes per pixel, more than RGB_565's 2 bytes, because it stores full color plus alpha. Thinking RGB_565 uses more reverses their actual sizes.

  6. Which statement about a memory leak in an Android app is accurate?

    • A leak always causes an immediate crash the moment it happens
    • A leak reduces available heap over time and may eventually cause an OutOfMemoryError, but the app can run for a long time first — correct
    • Leaks are harmless because the garbage collector reclaims everything on the next cycle
    • A leak only affects native memory, never the Java heap

    Why: Leaked objects stay reachable so the GC cannot reclaim them, gradually shrinking usable heap until an OOM may occur; the app often runs fine for a while. It does not crash instantly, and the GC cannot collect still-reachable objects.

  7. Why does holding a static reference to an Activity or its Context commonly cause a leak?

    • Static fields are stored in native memory that Android never frees
    • Static references are automatically weak, so this is actually safe
    • The static field outlives the Activity, keeping the entire view hierarchy and Context reachable after the Activity is destroyed — correct
    • Only Application Context can be leaked, never an Activity Context

    Why: A static field lives for the process lifetime, so referencing an Activity keeps it and its views from being collected after onDestroy. Static references are strong, not weak, and Activity Contexts are the classic leak source precisely because they are so large.

  8. Why is a non-static inner-class Handler that posts delayed messages a classic leak risk?

    • Handlers allocate native memory that is never freed
    • Handlers run on a background thread that outlives the Activity
    • Delayed messages are stored in Firestore and never cleared
    • The inner Handler holds an implicit reference to the outer Activity, and a queued delayed message keeps that Handler, and thus the Activity, alive — correct

    Why: A non-static inner class implicitly references its enclosing Activity, and a pending message in the MessageQueue references the Handler, keeping the Activity reachable past destruction. The issue is the implicit outer reference, not native memory or background threads.

Practice all 50 Performance & Memory questions

These 8 are a sample. The full Performance & Memory bank is scored, tracks your progress, and explains every answer.

Open the quiz

More Android interview topics