-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Local
-
None
-
?
-
Kotlin Beta sprint 39
-
671
As part of #596 we have started using the C-API's realm_add_realm_changed_callback and realm_add_schema_changed_callback but these callbacks are not unregistered when the realm is garbage collected. We need to hook this up with our native reference queue/cleaner API.
Until this is done the realm will not be closed unless explicitly closing the realm with realm.close(). To overcome this limitation in the memory test I have added an internal method to explicit release the callbacks https://github.com/realm/realm-kotlin/pull/596/files#diff-4d0528b8584520f9db14ff4031d83ca6cb837bcd889022c4abcc08b6309235baR188
We should either generalize the NativeObjectReference/CPointerWrapper to allow managing other things than native pointer and allow overriding the clean up action to unregister the callback tokens or rely on core to align the callback registration mechanisms as filed in https://github.com/realm/realm-core/issues/5217.