fun maxNumberOfActiveVersions(maxVersions: Long = 8): S

Sets the maximum number of live versions in the Realm file before an IllegalStateException is thrown when attempting to write more data.

Realm is capable of concurrently handling many different versions of Realm objects, this can e.g. happen if a flow is slow to process data from the database while a fast writer is putting data into the Realm.

Under normal circumstances this is not a problem, but if the number of active versions grow too large, it will have a negative effect on the file size on disk. Setting this parameters can therefore be used to prevent uses of Realm that can result in very large file sizes.

See also





the maximum number of active versions before an exception is thrown.