I created a simplified project and filed a feedback to illustrate the potential memory leak using withTaskGroup(of:). I say potential leak as perhaps I'm doing something proscribed, but I believe I've followed the recipe supplied in the Apple docs.
class TaskGroup {
static func perform() async {
let _ = await withTaskGroup(of: Void.self) { group in
for _ in 0..<18 {
group.addTask(priority: .userInitiated) {
await AsyncJob.job()
}
}
return
}
}
}
actor AsyncJob {
static func job() async {
syncJob()
}
}
func syncJob() {
var value: Double = 0
for count in 0..<100_000 {
value += Double(count)
}
}
Thanks for the prompt reply (and on weekend)! Will these fixes ship with Xcode 13.2 this week? While the toolchain version may have fixed the leaks, I'd like to deploy to the App Store.
I am also seeing this behaviour with my application leaking gigabytes of memory on macOS with Xcode 13.2 Beta (13C5066c) since adopting withTaskGrou(of:). My experience seems very similar to the Linux issue here:
I'm happy to hear that, was worried we missed something else still (and quite confused, since I checked many times and seemed fine, on all OSes, there were multiple issues after all).