Started having this issue today after Xcode automatically upgraded to 16. We're using React Native 0.74.5. XCBuildService rapidly eats up RAM (seen over 40GB used) until it crashes.
Downgraded to Xcode 15.4 + 15.4 Command Line Tools (via xcodereleases.com), and we're back in business.
Unbelievable, really, that Apple chose to release Xcode 16 when this issue has been reported multiple times:
https://forums.developer.apple.com/forums/thread/757008