React Native & Expo (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What causes Memory Leaks in React Native and how do you profile them?
senior LevelMemory Management
In Simple Words: Memory leaks in React Native can occur in both the JavaScript Heap and the Native Heap:
- JS Leaks: Uncleaned event listeners (
DeviceEventEmitter,AppState), dangling intervals (setInterval), retaining large data arrays in global Redux stores. - Native Leaks: Unreleased image bitmaps in native caches, unclosed SQLite connections.
- Profiling Tools:
- Chrome DevTools / Hermes Memory Profiler (takes JS Heap snapshots).
- Xcode Instruments (Allocations / Leaks) for iOS native memory.
- Android Studio Memory Profiler for tracking native Dalvik/ART and C++ allocations.