Xcode memory usage grows without control
| Originator: | enreas | ||
| Number: | rdar://21720888 | Date Originated: | 8/7/2015 |
| Status: | Open | Resolved: | No |
| Product: | Xcode | Product Version: | Tested in 7 GM (7A218) and 7.1 beta (7B60). |
| Classification: | Serious Bug | Reproducible: | Always |
Hello.
I don't know why, but when I create a project with certain Swift code, Xcode starts indexing and it never stops. Meanwhile, memory usage grows without control.
Attached, the source code that seems to be triggering the problem and a complete sample project.
Thank you for your time.
Steps to Reproduce:
1. Create a new Single View Application project.
2. Select Swift as language.
3. Mark "Use Core Data", "Include Unit Tests" and "Include UI Tests".
4. Add a new Swift file to the project.
5. The code of this new file is in the file DataHelper.swift (attached).
6. Press Cmd + B to build the project.
Expected Results:
- Xcode should be able to build the project.
Actual Results:
- Xcode will start building but it won't be able to do it.
- The amount of memory used by Xcode will grow without control.
- Next time you load the project it will start indexing and, again, Xcode will grow without control.
DataHelper.swift:
import Foundation
import CoreData
class DataHelper {
let context: NSManagedObjectContext
init(context: NSManagedObjectContext) {
self.context = context
}
func seedDataStore() {
seedArtists()
}
func seedArtists() {
let artists = [
(fullName: "Ignasi Aballí"),
(fullName: "Franz Ackermann"),
(fullName: "Pep Agut"),
(fullName: "Eija-Liisa Ahtila"),
(fullName: "Doug Aitken"),
(fullName: "Alfonso Albacete"),
(fullName: "Josef Albers"),
(fullName: "Carlos Alcolea"),
(fullName: "Helena Almeida"),
(fullName: "Augusto Alves da Silva"),
(fullName: "Francis Alÿs"),
(fullName: "Karel Appel"),
(fullName: "Nobuyoshi Araki"),
(fullName: "Vasco Araújo"),
(fullName: "Richard Artschwager"),
(fullName: "Elena Asins"),
(fullName: "David Austen"),
(fullName: "Shoja Azari"),
(fullName: "Francis Bacon"),
(fullName: "John Baldessari")
]
for artist in artists {
let newArtist = NSEntityDescription.insertNewObjectForEntityForName("Artista", inManagedObjectContext: context) as! Artist
newArtist.fullName = artist.fullName
}
do {
try context.save()
} catch let error as NSError {
print("Error: \(error.localizedDescription)")
}
}
}
Comments
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!