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

  • I encountered the same thing🥲


Build succeeded 17/12/2021 19:19 1731.0 seconds !!

  • I do confirm: Version 13.2.1 (13C100) does not resolve my latest issues in complex project. Compile time is extreme and memory consumption is still > 40 GB!

  • Turning off canvas prevents to run in this situation, i.e. background activities do not lither the memory and lead to the experienced misbehaviour. However, latest when it come to compile the swift module causing the issue, the problem will occur.

    Forcing quit of 'swift-frontend' or 'SourceKitService' before starting a build activity helps doing some housekeeping and getting 'faster' through build process. However, be patient. my 32GB RAM and additional swap gets consumed by a simple swift module modification. Hope this is coming to an end soon.

Add a Comment

Had this issue too, couldn't work at all. Updated to Xcode 13.2.1 (13C100) version. Now everything works as a clock!

I had Xcode 13.2.1 (13C100) and the issue remains. im running a MacBookPro15,1 with bigsur

I'm also having the exact same issue, it shows 50 GB memory usage and asks me to force quit apps to freeup memory. Very strange.

This is absolutely ridiculous, this should be a top priority at Apple. I am running 13.2 and ran into this now. After the restart Xcode pushes my Macbook Pro 2020 16GB to above 100c temps and gets stuck on building. How is this still an issue after so many months?? Now I am forced to downgrade to 12.5.1. Some devs are under a lot of deadline pressure, this is unacceptable for a company such as Apple that prides itself in its developer tools.

  • Looks like the issues are all fixed in my case in Version 13.3 beta (13E5086k). They persisted eventhough Apple brought some 'intermediate' fix, not resolving all issues. I hope the fix is now persistent.

Add a Comment

My M1 Max laptop with 64GB almost exploded today because of this thing... Look at these numbers :)

On a MacBook Air M1 (2020) 16GB with macOS 12.4 and XCode 13.4.1 (13F100) having the same issue - while developping a SwiftUI XCode is reporting an internal error and gets stuck... crashing the whole system. Swift Frontend going up until 100 GB (sic!). Should I downgrade XCode ? To what version? - Edit: After restart "Clean Build Folder" works. Then without any action after a few seconds the SourceKitService comes to live and starts eating Memory from 19 GB up till 110 GB and then disapears (crashes?). What the heck is going on here?

  • Error was "error: compile command failed due to signal 9 (use -v to see invocation) Command CompileSwiftSources failed with a nonzero exit code". After removing some unfortunate code (tried to have State vars in a Dictonary) by commenting out my latest changes XCode could run the build again. Seems like XCode is no friend of buggy code, crashing the whole system.

Add a Comment