Support for background state and App Extensions The limitation stems from deinit, which can call arbitrary code, including the Kotlin code that cannot be run during the GC pause. It requires two GC cycles to collect these four objects because deinitialization of Swift and Objective-C objects happens after the GC cycle. secondKotlinStorage is collected because firstSwiftStorage is no longer referencing it. There are no references to firstSwiftStorage, so it is "dead" as well, and deinit is called. firstKotlinStorage is considered "dead" because nothing references it, while secondKotlinStorage is not because it is referenced by firstSwiftStorage.įirst GC cycle starts, and firstKotlinStorage is collected. The reason is that firstKotlinStorage and secondKotlinStorage are collected in different GC cycles. It takes some time between "deinit SwiftStorage first" and "deinit SwiftStorage second" messages to appear in the log. SecondSwiftStorage: SwiftStorage("second") FirstSwiftStorage: SwiftStorage("first"),
0 Comments
Leave a Reply. |