I am using Big Sur 11.6 on my 2018 macbook pro with 16g ram. And I have this problem too. I suspect that it's something related to wrong type declaration. In my last mini project, I declared the wrong type and when it compiled the code. The memory usage jumped to 20g, 30g, 40g, ..g very quickly. Both the swift-frontend and SourcekitService. I correted the type and then I had to reboot the mac to fix it.
Sometimes Spotlight is taking up 100% cpu while I was just using xcode.
For my current project based on the mini project I mentioned above. I created an array of objects with custom type(1000 of star coordinates).
SourcekitService and swift-frontend take 40g each, and another swift-frontend thread takes up 29g of ram. The project can be complied and run but I have to wait 4 -5 minutes. If I create an empty array and append them one by one in a loop, the compile time is almost instant without memory problem.
update: when I try to get the custom type array count. The problem also happens.
https://imgur.com/a/8EMDTSM
Post
Replies
Boosts
Views
Activity
I was wrong about the fast build time. When I cleared the build cache, it also takes 4-5 minutes to build with about 80G memory usage.
And I added the .foregroundColor behind searchable() modifier and it just works.