What is Nostr?
Łukasz Rutkowski /
npub16yq…dek4
2023-09-03 09:04:22

Łukasz Rutkowski on Nostr: Discovered interesting SwiftUI memory leak bug in iOS 17 around creation of ...

Discovered interesting SwiftUI memory leak bug in iOS 17 around creation of StateObject (FB13108791). If you pass it a value initialized not inline it will never be freed:

This works:
self._myClass = StateObject(wrappedValue: MyClass())

This causes memory leak:
let myClass = MyClass()
self._myClass = StateObject(wrappedValue: myClass)

#SwiftUI #iOSDev #iOS17Beta8

Author Public Key
npub16yqdhhv5lvhlug6zuuv5v6v9vse4cr5f6dts4hap2cdc2j8rhuhqd2dek4