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

[Android] should i call Fresco.shutDown() in reactActivity.onDestroy() #8518

Closed
JuanbingTeam opened this issue Jul 1, 2016 · 6 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@JuanbingTeam
Copy link

JuanbingTeam commented Jul 1, 2016

I tried the following steps:

  1. start my RN app
  2. exit by pressing back button
  3. repeat 1,2 for several times

I found the memory keep increasing , and finally it lead to an OOM Exception.
With the help of AndroidStudio Monitor View, i found too many bitmaps were cached.

I tried to call Fresco.shutdown() manually in onDestroy, it seems better.

`@Override
protected void onDestroy() {

super.onDestroy();
Fresco.shutDown(); // call shutdown manually
if (mReactInstanceManager != null) {
mReactInstanceManager.destroy();
}
}`

Here are my questions:

  1. When will the images cached by Fresco be recycled?
  2. Do I need to release images manually?

Thanks guys....

@oprisnik
Copy link
Contributor

oprisnik commented Aug 1, 2016

This could be related to #8677. In theory, you should not need to do anything manually.

@norman-kapschefsky
Copy link

norman-kapschefsky commented Sep 20, 2016

Have to clear Fresco stuff as well in onDestroy() of ReactActivity. Without it the memory of app process gets higher and higher wenn starting and closing the app frequently. With the following lines of code the problem is gone. Should be investigated in more detail because that is critical I guess.

@Override
protected void onDestroy() {
    super.onDestroy();

    Fresco.getImagePipeline().clearMemoryCaches();
    Fresco.shutDown();
}

@oprisnik
Copy link
Contributor

This should have been fixed with recent React Native versions. RN was re-initializing Fresco which lead to these issues.

@JuanbingTeam
Copy link
Author

Thanks @oprisnik & @norman-kapschefsky , I will do more tests with latest version.

@ericnakagawa
Copy link
Contributor

Hi @JuanbingTeam I'll be closing this issue since there has been several updated versions of RN.

@JuanbingTeam
Copy link
Author

thank you, yes ,this has been fixed~

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants