Size of Realm Database completely out of proportion

Hi
I’m new to Realm and trying to write a .Net application that works with media data stored in a database. Standard stuff like title, artists etc.

My first few tries looked good. Than I added additional properties, mostly lists of primitives, and since then the size is completely out of proportion. At first it was less than 100Mb for less than 5000 entries. But after some refactoring it was suddenly more than 10Gb. I removed one list containing more than 100k of another RealmObject type, and the size for 1k elements was still more than 1Gb. I opened the database in Realm Studio, but there are no duplicates or anything.

I tried writing that reduced type to a LiteDB database for comparison, containing exactly the same data. After 20k elements it was less than 20Mb!

For some reason the Realm databse for the same type, containing 7 primitive properties and 14 lists of primitive types, half of which have only one or two entries at the moment, the other half has less than 10, is a thousand times bigger than the LiteDb database.

Since I’m new to Realm I don’t know what might cause this, so I don’t know what to look for. Does anyone have some helpfull ideas?

Regards

Thorsten

Realm is a bit funky when it comes to disk space. There’s some explanation in the docs but you will need to take a look at compacting your realm to remove the unused space. Take a look at

Compacting Realms

That’s the Swift docs.