(Disclaimer: I work for Realm. :)) Thank you very much! Nice to hear you are enjoying the kingdom!
A few instances of the kingdom - you do not need to worry about it! The Realm object of the file is created when the first instance is created in each thread, and the same object is subsequently returned every time you try to execute it every time after that.
Vault Instances - Following from the first moment, no, you donβt have to worry about linking to Realm inside other objects. Since Realm keeps track of its Realm file objects within itself and returns the same ones, you will not be punished for it. However, if the permalink to a Realm object within your object simplifies your code complexity, feel free to continue using it.
Access to Realm property properties - Strictly speaking, data from Realm files are not copied from disk (like regular ORM); more he uses memory mapping to directly reference data from disk directly to your properties in memory. So no, you donβt have to worry about Realm files getting too big in memory.
Auto update Auto-update is enabled by default for the Realm file object in the main thread. It must be manually enabled for Realm file objects in other threads, or you can instead manually update them by calling the refresh method.
EDIT: I stand fixed! All Realm file objects on multiple threads have autorefresh by default. If autorefresh enabled, the only time you need to call refresh is to make changes to the Realm file reflected in other links until the current iteration of the run loop completes.
Link to the object Link to the area Absolutely not, this is a good practice in general! I actually prefer to do this in my personal applications that use Realm to provide the proper context, as it is always simpler and provides a stronger visual context between the object and its parent Realm file in the code. (Haha, if there was a problem with threads here, you would probably find it before reaching the write point).
I hope this helps! Let me know if you need to clarify anything here!
TiM Jul 23 '15 at 17:43 2015-07-23 17:43
source share