How can I debug memory leaks in react-native Expo project?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-30 09:42:05

问题


I am running a react-native Expo project on both ios simulator, which uses XCode, and android emulator, which uses genymotion. There is a crash sometimes when using the app on real android phone. I am hoping to find out the reason debugging it on the emulator.

So far, I searched for tools for this, but did not encounter any.

Could anyone tell me available tools for debugging memory leaks on genymotion emulator? I also welcome any other advices to fix my problem.

Thanks in advance!


回答1:


You can gain a ton of insight using Infinite Red's Reactitron

You might also want to check out Perf Monitor which you can access from the Debug menu.

There's a whole page on profiling and troubleshooting perf issues in the react native documentation. https://facebook.github.io/react-native/docs/performance.html




回答2:


With Expo you'll need to detach.

For Android you can find tutorial here.

For iOS:

  1. Make sure you have Release Schema
  2. Go to XCode → Product → Profile (⌘ + i) and you'll find:
  3. It should open your leaks profiler on the screen and then click on the red dot.
  4. Restart the app in simulator.
  5. You should see your memory allocations in the leaks profiler window.


来源:https://stackoverflow.com/questions/46444793/how-can-i-debug-memory-leaks-in-react-native-expo-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!