Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing animation is causing memory leaks #1819

Closed
KDederichs opened this issue Jun 2, 2020 · 4 comments
Closed

Typing animation is causing memory leaks #1819

KDederichs opened this issue Jun 2, 2020 · 4 comments
Assignees
Labels

Comments

@KDederichs
Copy link

Issue Description

When you open a chat you can see the device CPU constantly around 50 to 60% as well as a steady incline in memory usage.

Steps to Reproduce / Code Snippets

Open a chat, look at your metrics.

Expected Results

It doesn't leak memory/cpu

Additional Information

  • Nodejs version: v12.14.1
  • React version: 16.11
  • React Native version: 0.62.2
  • react-native-gifted-chat version: 0.16.1
  • Platform(s) (iOS, Android, or both?): both (I think)
  • TypeScript version: 3.9.3

After a lot of searching I finally arrived at the root of this, the react-native-typing-animation used in TypingIndicator is CONSTANTLY animating causing this to happen.
Good options would be to either not use this and write one that's less performance hungry OR not mount it until the user is actually typing.
The current solution seems to be letting it run in background and hiding it with the opacity which is suboptimal

@xcarpentier xcarpentier self-assigned this Jun 24, 2020
@marqroldan
Copy link

marqroldan commented Jul 1, 2020

Hello, I would just like to point out that I think this is still an issue.

I did some ugly checking by removing the whole isTyping block and the CPU jumped to almost 0% (as it should be)
This doesn't seem to be an issue on Android (as I never noticed this) but on iOS it has a very bad impact

@xcarpentier
Copy link
Collaborator

xcarpentier commented Jul 1, 2020

Hi @marqroldan,
I removed it from the render tree if not typing, maybe this is an issue on unmount? d83c800
Can you please share your performance analysis (ie. screenshots)?

@shamilovtim
Copy link
Contributor

@KDederichs how did you discover that the animation was to blame for this?

@KDederichs
Copy link
Author

Been a while but I think it was a mix of profiler (on mac) the memory graph and then systematically narrow down what it could have been

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants