swift-frontend memory usage

I think I've found a memory leak with GeometryReader. The memory footprint of swift-frontend grows 50gb> with this single line

I have detailed the issue here: https://github.com/Func-Main/swiftui-memory-bug

Is anyone able to confirm? I don't think this is an issue related to the purely to the .aspectRatio modifier, but rather GeometryReader in general.

This image was after 30 seconds

50gb?

After 1 minute of testing I saw the process list 42gb

Hi, go ahead and report this on Feedback Assistant and attach the link to your GitHub repo. If the Swift team is able to reproduce it, they’ll try to fix it.

I actually think I’m running into a few different situations where Xcode 13 memory with SourekitControl and Swift-frontend is spiralling. I’ll try and document a few other situations when they arise. The above issue occurs on a 2018 MacBook Pro and a fresh setup m1 MacBook Air (which I initially bought to try and brute force the problem away)

I started learning Swift today ( M1 MacBook Air 16gb ) and was very surprised to get a pop-up window asking me to kill some app to get some RAM back. Checked in the Activity Monitor and had swift-frontend at apx. 54 GB memory. Super super simple project, just laying out some UI elements. Quit Xcode and reopened the project, clicked Resume in the Canvas and looked how swift-frontend start eating RAM again . After 3 min or so the Preview still didn't launch.

Closed Xcode again and just opened the project and did nothing while writing this post, after a few minutes the process was over 50 GB.

Using Source Control as well ( GitHub ) in case its relevant. Attaching a capture from the Activity Monitor and one from the project.

I encountered the same thing🥲

Getting the same thing. I had two instances of swift-frontend using ~30Gb each, and it kept increasing even after I'd force-quit Xcode 🤪

Same issue here, Xcode 13 & Mac Mini M1. After upgrading to Xcode 13, some views causing the issue when rendering the canvas. Multiple instances of swift-frontend, > 50GB in total. Makes my project totally unworkable.

I had the same issue and had to downgrade Xcode to 12.5.1 and the issue is gone. First I tried removing some code, including GeometryReader to avoid the problem, but it did not work. Tried other things such as restart Xcode, mac, launching other projects, cleaning derived data, cleaning up space for swap files etc. Nothing worked.

With 12.5.1, there is not even one single process called swift-frontend, all views are rendered well in Canvas. I'd love to hear a possible solution as I would need to build for iOS15 eventually.

Following on from @alpsoy suggestion that this bug isn't present in Xcode 12.5.1 I've recreated the bug project. I can confirm that on Xcode 12.5.1 neither SourceKitService nor swift-frontend show the same memory bug.

https://github.com/Func-Main/BugTester12

Haas anyone confirmed if this is an issue on Monterey? Maybe that could help...

Memory Consumption Issue makes working with XCode 13 impossible. Even right after a mac reboot/login, the memory request grows up to 40 GB and more right after launch of XCode. I can't find out the root cause as Xcode 13 was working since last official release 13, but suddenly the issue appeared as of today while not modifying the XCode installation (updates are configured as manual).

Does Xcode 13.1 RC help to fix the issue?

This doesn't seem to be related to a macOS release (issue happens also on Big Sur). Some parsing mechanism is getting in some deadlock populating the same process if unresponsive. I've filed an own bug report. Sharing the feedback report reference will not help here. At least, my report was identified as critical and I've got almost immediate processing response. I've requested a possible workaround to help out faster (than a XCode bug fix).

The issue appeared with XCode 13 official release. Probably, the last XCode 13 Beta was still fine.

swift-frontend memory usage
 
 
Q