InterviewStack.io LogoInterviewStack.io

Mobile Memory and Resource Management Questions

Covers memory management principles and resource handling for mobile applications across platforms. Candidates should understand platform specific models such as automatic reference counting on iOS and garbage collection on Android, common causes of memory leaks and retain cycles, and how reference ownership and weak versus strong references affect lifetime. Include techniques for releasing resources correctly in lifecycle methods and avoiding long lived references that hold activity or context objects. Expect knowledge of memory profiling and diagnostics including tools and workflows for locating leaks and high memory usage, strategies to prevent out of memory conditions, and trade offs such as requesting a larger heap. Also cover cross platform considerations for frameworks like React Native and Flutter and practical practices for identifying and fixing real memory issues in production, such as analyzing heap dumps, using allocation instrumentation, and applying targeted fixes and regression tests.

EasyTechnical
114 practiced
Write Kotlin code you would include in an Activity's onDestroy to safely release heavy resources such as Bitmaps, adapters that reference Views, database Cursors, sensors, and listeners. Explain why each step helps avoid leaks and what else you might do to ensure resources are freed.
HardTechnical
94 practiced
Describe how you would detect and fix native (C/C++) memory leaks in a mobile app that uses JNI or custom native libraries. Include tools and techniques you would use on Android (Address Sanitizer, Native Memory Profiler, special build flags) and iOS (Xcode Instruments, Address Sanitizer), how to reproduce leaks, interpret leak reports, and remediation strategies such as RAII, smart pointers, and explicit lifecycle-based frees.
MediumSystem Design
77 practiced
Design a memory budget and monitoring plan for minimizing memory use during app cold start (first launch). Specify metrics to measure (initial RSS, Java/Dart heap, native heap, number of allocations, peak memory), threshold guidelines for device classes (low/median/high), strategies to reduce startup memory (defer lazy initialization, avoid loading large resources on startup), and how to detect regressions in CI builds.
EasyTechnical
69 practiced
What are common causes of retain cycles and memory leaks in Flutter apps? Discuss scenarios such as State objects capturing callbacks or Streams without cancelling, Timers not cancelled on dispose, holding BuildContext across async gaps, plugin native resources not disposed, and global singletons that keep widget-related references.
HardTechnical
60 practiced
You have an Android heap dump (.hprof) that shows thousands of retained instances of an Activity subclass and many Bitmap objects associated with them. Describe, step-by-step, how to analyze the dump to find the root cause: converting and loading into MAT or Android Studio, using the dominator tree, finding GC roots and retention paths, identifying static fields, thread locals, or singletons holding references, and propose fixes and verification steps.

Unlock Full Question Bank

Get access to hundreds of Mobile Memory and Resource Management interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.