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

feat: Trim MMKV on memoryWarning - GC safe via WeakRef! #741

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

mrousavy
Copy link
Owner

This now calls trim() on the MMKV instance whenever a memory warning occurs. This prevents out of memory errors.

To prevent the MMKV instance from being forever held strong, we now use WeakRef and FinalizationRegistry, if they are available (RN 0.75+)

@mrousavy mrousavy merged commit 9eab449 into main Sep 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant