Swift 不支持 MRC 我的情况
for 0..<1000 {
creat image context
get image
end image context
}
在住线程上执行,context 要在循环执行完后在 runloop 上回收,这样 context 越来越多,内存会爆掉
已经试过的办法
for 0..<100 {
autoreleasepool {
creat image context
get image
end image context
}
}
```Swift
for 0..<100 {
creat image context
get image
end image context
dispatch_async {
context = nil
}
}
我现在的做法是
creat big image context
for 0...100 {
creat image
adjust context
}
end image context
但是这样也是很有限的,image context 非常占内存 图片 4000 * 12000 的时候占到 200 多 MB
所以不知道 iOS 有没有其他的 API, 可以生成超大的图(4000 * 100000) 但是可以一点一点的生成并写到文件,同时可以不断的手动创建对象和释放内存