Post

Replies

Boosts

Views

Activity

Does @Relationship(inverse:) create a memory leak?
Hi, I am creating (or trying to) my first app using SwiftData - and I have questions :-) The main question I can't get my head wrapped around is the following: Let's say I have the sample below... @Model class Person { @Relationship(inverse:\Hat.owner) var hat:Hat } @Model class Hat { var owner:Person? } It looks like I am creating a strong reference cycle between the person and the hat objects? And in fact I am seeing these kinds of reference cycles when I look at the memory debugger. Many code samples I have seen so far use this type of relationship declaration... And I am wondering: Am I missing something? Admittedly I don't find many discussions about memory leaks caused by SwiftData despite the syntax being used in many examples? So what is the situation? Did Apple just miss to explain that the inverse: declaration causes memory leaks or is there some kind of magic that I should understand?
2
0
123
Mar ’25
Metal: Non-uniform thread groups unsupported in Simulator? Is it?
My app is running Compute Shaders that use non-uniform thread groups. When I run the app in the debugger with a simulator target the app crashes on encoder.dispatchThreads and the error message is: Dispatch Threads with Non-Uniform Threadgroup Size is not supported on this device. Previously the log output states that: Metal Shader Validation is unsupported for Simulator. However: When I stop the debugger and just run the app in the simulator without the debugger attached, the app just runs fine and does not crash. The SwiftUI Preview that also triggers the Compute Shader when preparing data also just runs fine without a crash. I can run and debug on a real device no problem - I just don't have all sizes available. Is there anything I need to check in my lldb/simulator configuration? It obviously does work, just the debugger cannot really deal with it? Any input would be nice as this really slows my down as I have to be extremely careful when debugging on the simulator.
2
0
538
Mar ’25