Running any test target causes Xcode to freeze and leak memory

Originator:macecchi
Number:rdar://29457541 Date Originated:2016-12-01
Status:Open Resolved:No
Product:Developer Tools Product Version:8.1
Classification: Reproducible:Always
 
Summary:
Every time I add a test target (UI test or unit test) to my iOS app and press the Test button (or the shortcut cmd+u), Xcode freezes (the spinning rainbow appears).

The same thing occurs if I run the tests using xcodebuild.

I've tried waiting but then noticed that the memory usage grows very quickly. In about 20 minutes I had Xcode using more than 60 GB of memory, as seen on the screenshot.

Steps to Reproduce:
1. Clone my iOS app project
2. Add a test target (UI test or Unit test) using the File > New > Target menu
3. Run tests (either by pressing the button, cmd+u or `xcodebuild test`)


Expected Results:
Build app, open the simulator and run the tests.

Actual Results:
Xcode freezes and leaks memory infinitely until I force quit it. It does not even start building, neither does it open the Simulator.

Version:
Xcode Version 8.1 (8B62)
macOS Sierra 10.12.1 (16B2555)

Notes:
I've attached the report that shows up after force-quitting Xcode.
The project consists of an iOS app, a Today Widget and a Watch App/Extension.
The project uses mixed Objective-C/Swift 3.0.1 code.

Configuration:
It happens specifically with my iOS project, which compiles and runs normally and is a big app already on the App Store.

The steps are reproducible on other machines with the same configuration as well.

Comments

Mario Cecchi

Although I haven't been contacted and it does not appear on the release notes, this appears to be fixed in Xcode 8.3 beta 1.

Apple Developer Relations

Engineering has provided the following information regarding this issue:

We believe this issue has been resolved. The fix will be included in a future update. We will contact you to verify the fix once it’s released.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!