0
0
React Nativemobile~5 mins

Memory leak detection in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a memory leak in React Native?
A memory leak happens when the app keeps using memory that it no longer needs, causing the app to slow down or crash over time.
Click to reveal answer
beginner
Why are memory leaks bad for mobile apps?
Because mobile devices have limited memory, leaks can make apps slow, use more battery, or crash, leading to a bad user experience.
Click to reveal answer
intermediate
Name a common cause of memory leaks in React Native components.
Not cleaning up timers, subscriptions, or event listeners when a component unmounts can cause memory leaks.
Click to reveal answer
intermediate
How can you detect memory leaks in a React Native app?
Use tools like React Native Debugger or Xcode Instruments to watch memory usage and find if memory keeps growing without releasing.
Click to reveal answer
intermediate
What React hook helps prevent memory leaks related to side effects?
The useEffect hook with a cleanup function helps remove timers, subscriptions, or listeners when the component unmounts.
Click to reveal answer
What happens if you forget to clear a timer in a React Native component?
ANo effect on memory
BThe app will automatically fix it
CThe timer stops by itself
DMemory leak because the timer keeps running
Which tool can help you monitor memory usage in React Native?
AReact Native Debugger
BPhotoshop
CExcel
DSlack
What should you do inside useEffect to avoid memory leaks?
AReturn a cleanup function to remove side effects
BDo nothing
CCall setTimeout repeatedly
DIgnore component unmount
Memory leaks in mobile apps can cause:
AMore storage space
BFaster app performance
CSlower app and crashes
DBetter battery life
Which of these is NOT a common source of memory leaks?
AUnremoved event listeners
BProperly cleaned up subscriptions
CUncleared timers
DRetained references to unused objects
Explain what a memory leak is in React Native and how you can prevent it.
Think about what happens when you forget to stop something running in your app.
You got /3 concepts.
    Describe tools and methods you would use to detect and fix memory leaks in a React Native app.
    Consider how you watch memory and clean up resources.
    You got /4 concepts.