Reputation: 5607
Last day I started using Realm as Android storage rather than Sqlite.
Everything went well till I searched for some pros and cons; someone said that it doesn't support delete (I was shocked). but I found that there is a delete section in documentation and I implemented sample application that adds 150 row and then I 'delete' them as the following answer said.
The size of list after deleteing is 0 which is logically right. But when I checked the size of myDB.realm file in the 'data/data/' path in the emulator, I found it the same size of the file before deleting. So does Realm flag items as deleted or physically deleting it?
Upvotes: 0
Views: 125
Reputation: 20126
The data is physically deleted, but right now Realm doesn't automatically reclaim the used space (it is on our TODO). In the mean time, you can manually call Realm.compactRealm(realmConfig)
if you want to reclaim the space: https://realm.io/docs/java/latest/api/io/realm/Realm.html#compactRealm-io.realm.RealmConfiguration-
Upvotes: 1