[Performance Issue] React native app crashes after several seconds

Spread the love

App crashed after several seconds.

Sometime, app is running smoothly and suddenly crashed after several seconds or minutes, we don’t know what happened. With my experience, I found some reasons which could be your problems. So, lets check it out and see if one of them are your issues.

  1. The first reason could be somewhere in your code, you don’t check null or undefined before using that object. It’s easy to figure out this problem. Just need to enable debugging mode and use app for a while then you are able to reproduce problem.
  2. The second reason: it’s really tough to figure out this issue even in debugging mode. That’s heap memory size. You could encounter this issue if you are using many large PNG images in your app. This is a known issue which is mentioned in react-native official page (https://facebook.github.io/react-native/releases/0.23/docs/known-issues.html) . To fix this issue, there are some ways to do like this:
    1. If you know native code, you can write a module to reduce image size ( I don’t choose this way because I don’t know native code :D)
    2. Try to use images with size as small as possible. To do this, you can handle images from server side, whenever an image is uploaded to server, save this image to different versions such as: thumbnail, medium and actual size, save them to cdn. From client, fetch the properly images with specified size.

If you guys know others reason, please let me know then I can add them to the list, it would be useful for others in future.


Leave a Reply

Your email address will not be published. Required fields are marked *