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?
✗ Incorrect
If you don't clear timers, they keep running and hold memory, causing leaks.
Which tool can help you monitor memory usage in React Native?
✗ Incorrect
React Native Debugger can show memory usage and help find leaks.
What should you do inside useEffect to avoid memory leaks?
✗ Incorrect
Returning a cleanup function removes timers or listeners when the component unmounts.
Memory leaks in mobile apps can cause:
✗ Incorrect
Leaks use memory unnecessarily, slowing the app and causing crashes.
Which of these is NOT a common source of memory leaks?
✗ Incorrect
Proper cleanup prevents leaks; not cleaning up causes leaks.
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.