Closed bobekos closed 2 years ago
@bobekos I am afraid the link to the project has expired, would you mind reposting it again?
@clementetb Sure have create a repo -> https://github.com/bobekos/RealmRx
Thanks for reposting the project.
It looks like the garbage collector is not quick in at the right time, and it is causing issues. We would recommend to find an alternative solution to frozen objects. You could use a background handler thread that would leverage the computation. A handler thread would enable notifications on your Realm and will keep the Realm instance on the latest version.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
How frequently does the bug occur?
All the time
Description
If we fetch the data over the RxJava function the objects got freezed to make it possible to move them over different threads. That's ok and it should work like this. But what if we doesn't want to listen to the changes but fetch only one result. Then the freezed realm instance should be closed or not? But this seems to not working correctly.
So for example if we have this here (you can do this with all kind of "single" rx-operators like single completable or maybe):
the single obsever dispose after the first return but the global instance is still 2. Is that correct? In my option the realm on the other thread should be closed when the single observer get disposed. But this happens only when i close the main realm instance.
So when the "main" realm instance is attached to a livecycle component (for example activity) we have two global instances running which cause the realm file to grow really fast.
I have attached a demo project where you can reproduce this behavior.
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
No response
Version
10.8.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
Android Version 12
Build environment
No response