Open alexisskodak opened 3 weeks ago
When documents are fetched from the storage, their RxDocument instance is cached and reused. We use a WeakRef for that and the documents get cleared from cache after some time if they are no longer used. If that does not work, you likely created a memory leak my referencing to all these documents somehow.
are you saying that calling the destroy method is not really 'needed' and the cached documents should be garbage collected eventually ?
yes
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.
I am having trouble understanding why long lived
RxCollection
instances store all of the data in memory.The documentation states that the
RxCollection
instance should be destroyed with the.destroy()
method in order to free up memory, and it works. However it is still unclear to me why theRxCollection
instances load all of the data into memory in the first place.here's a basic flow explaining how I am currently using it:
Without destorying the RxCollections, the JS Heap is reaching around 1.5GB on certain pages which makes the app crash on certain devices.
is this something that can be adjusted through configuration ? If not, what is the intended use of this ? Maybe I'm using RxDB incorrectly ?
Thanks