0

I got this error while writing and modifying thousand of record:

Unrecoverable error. mmap() failed: Out of memory size

And I found out that this is due to the dimension that the transaction occupy on the device memory. So I split the single, big transaction in smaller transactions and now I don't get the error anymore. But I noticed that the default.realm file is getting bigger. I read that if the application does a lot of transactions this is normal, because each transaction also write a log in the same file where the data is stored

Is there a way to clear the unnecessary data? I already use Realm.compactRealm at the application startup but this doesn't seems to free all the unused space.

michi07
  • 105
  • 1
  • 6
  • This happens primarily if you have open Realm instances on non-looper background threads that are never closed. Very common if you do anything like `Realm.getDefaultInstance().someMethod()`. – EpicPandaForce Nov 12 '19 at 16:22
  • I always do `try(Realm realm = Realm.getDefaultInstance()) { ... }`it should close it automatically this way – michi07 Nov 15 '19 at 08:15
  • Yes, yes it should. Maybe you really just have 2 GB+ data? – EpicPandaForce Nov 15 '19 at 11:16

0 Answers0