[英] What is the equivalent of @autoreleasepool in Swift?
在Swift中,我注意到没有@autoreleasepool{}
构造,尽管Swift确实使用ARC.在Swift中管理自动释放池的正确方法是什么,或者它是否因某种原因被删除?
在Swift中,我注意到没有@autoreleasepool{}
构造,尽管Swift确实使用ARC.在Swift中管理自动释放池的正确方法是什么,或者它是否因某种原因被删除?
语法如下:
autoreleasepool {
/* code */
}
不幸的是,苹果的WWDC 2014视频似乎不再可用.如果它回来了,WWDC 2014年会议视频418"用仪器改进你的应用程序"中会介绍它.
swift documentation目前没有任何有用的东西.但是你可以在NSAutoreleasePool和Advanced Memory Management Programming Guide的Obj-C运行时参考中找到很多好的信息.
101 Auto Release Pools are no-longer as relevant today as they were in the past. Modern code should use Automatic Reference Counting which does not use release pools at all. However there's still a lot of legacy code, including in Apple's frameworks, that use auto release pools as of 2021. If you're doing any kind of batch process on images as one example, you probably should be using an 100 block.
如何在 SwiftUI 中为删除和禁用配置 ContextMenu 按钮?
iPhone 不可用.请重新连接设备. / iOS 14.2 - Xcode 12.1
新项目的 SwiftUI 2.0 CoreData 问题 - '在范围内找不到类型'项目''
SwiftUI 中 ObservedObject 和 StateObject 有什么区别
相当于在 Swift Combine 中使用 @Published 计算的属性?
无法从构建环境获取 Google 服务文件中的 GOOGLE_APP_ID
根据禁用与否更改 SwiftUI 中按钮的 colored颜色
Xcode 构建错误 - 多个命令生成 .o,目标“ProjectCoreData”具有两次列出的 Swift 源文件的编译命令