How to fix react native console.log memory leak

307 views Asked by At

I am using twilio-chat to make a chat app in react native. After I create client, I tried to console.log the client entity, but then I saw the performance monitor in expo showed the memory used is increasing and the UI freezed, then the app crashed.

How do I fix it? Or do you think it is a twilio-chat library bug?

Edit: I have found the culprit, its because of circular reference in the twilio-chat objects, logging these objects will in react native will cause memory leak.

My workaround is to stringify the objects, and hope one day they fix this issue.

1

There are 1 answers

1
Nikita Filimonau On

I have faced with the same issue, but it was because I have stored client / channel object in reducer. I think it could be close. Please check when and where you throw / use this objects.