Xcode build causes memory issue

Using MacOS 10.14.1 (Mojave), Xcode 10.1


Summary: Certain builds cause extreme memory usage


When performing certain builds on Xcode (for any device, virtual or actual), the memory usage becomes excessive.


In Activity Monitor, these are the stats: Physical Memory, 16 GB, Memory used 15.62 GB, Cached Files: 385 MB, Swap Used: 1.24 GB, App Memory 640 MB, Wired Memory 13.8 GB, Compressed: 1.17 GB. The memory for Xcode itself is aboug 400 MB, with aboug 300 MB Compressed.


Memory pressure in the Activity Monitory is red.


This situation is caused by the build action in Xcode. I have run this without any other apps running, and the result is the same.


Given the fact that memory is swapping, the build takes a very long time and the computer is otherwise unusable.


When the build finally completes, the system eventually recovers, to this status: Physical Memory: 16 GB, Memory Used: 8.79 GB, Cached Files: 2.87 GB, Swap Used: 913.8 MB, App Memory 2.88 GB, Wired Memory 4.75 GB, Compressed: 1.12 GB


The computer becomes usable at that point. App memory is very high - SimStreamProcessorService is uing 706 MB, lidb-rpc-server is using 514 MB - I don't know what either of those are. Swap Used is still greater than 0, but it must be mostly filled with XCode so does not affect other processes.


This does not happen with every Xcode build. A different project, with seemingly more complexity than the problematic project, builds quickly with no memory issues.


I can provide more details about the problematic project if that might help. It is relativley simple. It uses the VLC library, which is not used by the project that compiles without a problem, but it has used VLC in the past without this problem. The project also uses WKWebView and ReplayKit.


Thanks,

Geoff

Replies

> A different project, with seemingly more complexity than the problematic project, builds quickly with no memory issues.


In that example, I think the general assumption is that Xcode is relying on a fully indexed project vs. one that needs to be re-indexed.


You'd need to test bed examples to confirm, which might prove too laborious to be worth spending time on, however.


If you believe the issue is endemic to just one project, you might want to burn a support ticket w/DTS and let them take a look at it.

5 feb. 2020 - Still no luck )))


Xcode Version 11.3.1 (11C504)

OSX Version 10.15.3 (19D76)


Same issue with LLDB.

`lldb-rpc-service` consumes more than 2Gb memory. It does not depend on the project, this problem in general with OS X and LLDB.

I bought MacBook Pro with 16Gb and I work normally, only some times I have got crashes this service,

But my colleagues on 8Gb become angry 😉

Hi, I know that this answer is quite late, but for the sake of future developers with the same problem, I would advise you to check the images in your assets folder. If any of your images have dimensions larger than 1000 x 1000 you should scale them down. With the example above, the image comprises of 1000000 pixels. Following how images are loading in (4 bytes per pixel), this means 4 MB of memory is used to load the image. Unbeknownst to me, I had an image of roughly 3600 * 4000 in my assets folder. Doing the maths, this was over 50 MB of memory usage!

I hope this helps someone :)