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

SaveableStateRegistry overflow causes TransactionTooLargeException #375

Closed
KuDaniil opened this issue Mar 15, 2023 · 1 comment · Fixed by #377
Closed

SaveableStateRegistry overflow causes TransactionTooLargeException #375

KuDaniil opened this issue Mar 15, 2023 · 1 comment · Fixed by #377
Labels
bug Something isn't working

Comments

@KuDaniil
Copy link

How to reproduce:

  1. Using sample sanbox app, setup https://github.com/guardian/toolargetool tool
  2. Enable "Don't keep activities" in dev settings
  3. Minimize app, look at logcat. androidx.lifecycle.BundlableSavedStateRegistry.key takes 3.6 KB
  4. In sanbox navigate back and forth to NavModel Examples
  5. Minimize app again, now androidx.lifecycle.BundlableSavedStateRegistry.key takes much more than 3.6 KB

What's wrong:
If you'll take a look into saved bundle, you can see that even disposed Nodes still keeps some of their data in saved state registry
Thus, more we navigates through the app, more garbage collected in SavedStateRegistry, and at some point it causes TransactionTooLargeException after app pausing

You can find saved NavKeys and some data in output bundle using debugger:
(outputBundle.getBundle("androidx.lifecycle.BundlableSavedStateRegistry.key").get("SaveableStateRegistry:-1") as BaseBundle)
Than mMap -> values[0] -> [0]

My assumption what's wrong (i might be way off):
Appyx registers SaveableStateProvider https://github.com/bumble-tech/appyx/blob/1.x/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Child.kt#L46 but never unregisters it, neither Compose does

Want to notice that in sample app overhead after each navigation isn't that big, but in my app (may be because of NavTarget data size) each navigation takes much more memory

@KovalevAndrey
Copy link
Collaborator

Hi @KuDaniil thank you for submitting the issue, we'll take a look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants