Memory leak in Property.swift
I've been working to track down leaks within our app and have found that there appears to be a common thread to all of them.
Under fileprivate init(unsafeProducer: SignalProducer<Value, NoError>) I am seeing multiple leaks from different parts of my app that all point to this call:
disposable.inner = unsafeProducer.start { [weak box] event in
This is happening with the current 4.0 version, as well as 3.1.
I am using XCode 9.4.1 and am targeting an iOS 11.4.1 device (so leak is seen on hardware and not in simulator).
In most of the cases I have identified, it is happening when accessing a Property value.
Any property that uses that init leaks for me too.
How are you seeing that this is a leak?
Does it still appear as a leak after that SignalProducer completes?
ReactiveSwift does some things that can result in false positives in Instruments.
class Test {
var urlProperty: Property<URL>
var anotherUrlProperty: Property<URL>
init() {
urlProperty = Property<URL>(value: URL(string: "http://google.com")!)
// Leak!
anotherUrlProperty = Property<URL>(urlProperty)
}
}
I just created a new project and instantiated this Test class and Instruments shows the second property leaking.
I don't see any leaks with that snippet in Instruments.
On device I see this leak.
Hello. 👋 Thanks for opening this issue. Due to inactivity, we will soft close the issue. If you feel that it should remain open, please let us know. 😄