No need to freeze empty RealmList

This was the source of growing memory usage. Non empty result are supposed to be temporary, so this is fine.
This commit is contained in:
Benoit Marty 2023-01-17 16:32:49 +01:00
parent b3a50d4f68
commit 0b5e0fea72
1 changed files with 2 additions and 1 deletions

View File

@ -72,7 +72,8 @@ internal class RealmSendingEventsDataSource(
if (frozenSendingTimelineEvents?.isValid == true) {
frozenSendingTimelineEvents?.realm?.close()
}
frozenSendingTimelineEvents = sendingEvents?.freeze()
// Do not freeze empty list
frozenSendingTimelineEvents = sendingEvents?.takeIf { it.isNotEmpty() }?.freeze()
}
override fun buildSendingEvents(): List<TimelineEvent> {