Since adding frozen objects, I have gotten a few out of memory errors in production. I have read the issues on GitHub and tried to follow the suggestions there https://github.com/realm/realm-cocoa/issues/6469. I was definitely keeping frozen references too long while doing write transactions, something I have now adressed.
But, it still makes me wonder. I currently don’t use “compactOnLaunch” for my local realm. Should this always be used? What is the default setting, does it never compact if this setting isn’t specified?
The docs here: https://docs.mongodb.com/realm/sdk/ios/advanced-guides/compacting/ says that I should experiment with compaction to see what setting to use. I don’t mind adding a setting, but how do I know what is a good setting? I assume that compaction is done on first access in the same thread. Can I detect that this is needed before executing the compaction? Does compaction need to be run on a background thread?