DB data keeps on increasing and db data automatically get clear in android


I am new to realm db and I am facing an issue that my app’s data keeps on increasing if I put the app on idle state and after reaching more than 2 GB data the app gets killed and the data of db gets automatically cleared.

Note: I have closed all the instances of db in onDestroy method.

One of the keys to receiving help here on the forums is to provide enough details and information to understand the issue. Along with that is to do some troubleshooting before posting.

So the first thing to do is to put a breakpoint in your code and run your app. Step through the code line by line, inspecting the vars and code execution until you spot something unexpected. For example you may have created a loop that continually writes data to Realm.

Also including the code that’s causing the trouble is helpful to us - keep in minimal but verifiable.

So, do a bit of troubleshooting and refine your question with additional details.