Our data model is getting larger and larger, and now our app is not able to run on device anymore.
After doing a lot of debugging, we think the reason is that the stack memory footprint of our MainViewState struct is getting too high.
(lldb) p MemoryLayout<MainViewState>.size (Int) $R0 = 38704
So the first question is; Have anyone seen the same issue, and how did you solve the increasing size of the sate structs?
Ok, so I started testing; what if I move some of the data in the structs into classes? - The memory footprint of the struct decreases, but I am not sure about the consequences. I understand that the structs will just copy the value of the pointer to data objects, and not the object itself.
The second question is; Is it ok to point to objects inside the State structs, and what are the consequences?
We have tested the app with the latest TCA version, 0.14.0, and it performed better than with 0.8.0. The newer version works with larger MainViewState than 0.8.0. Would love to hear if someone has experience with this issue, or tips on how to proceed.