我是新的Mac应用程序开发与Swift。但我试着制作简单的ImageResizer应用程序。我必须重新调整50k图像的大小。10小时后,内存增加到了120 to。我以为斯威夫特也有垃圾收集器。为什么它会增加记忆?我会给你看我的密码。
for i in 0..<paths.count {
let path = paths[i]
if let image = NSImage(contentsOf: path) {
...
if self.resize(image: image, size: size, to: URL(fileURLWith
我的iOS应用程序有内存问题,我对此有几个问题。
第一,我使用的是iOS 6,我使用的是ARC。
现在让我解释一下我的情况:
我有两种观点。在第一个视图中,如果我点击一个按钮,就会创建第二个视图(使用alloc和init),并使用以下代码将其显示为模式:
[self presentViewController:secondView animated:YES completion:^{
[secondView prepareToDraw]; // Function I use to start my computations and rendering
}];
在某个时候,当
就像下面的代码片段一样,它在这个方法中使用@autoreleasepool块。
+ (UIImage *)decodedImageWithImage:(UIImage *)image {
// while downloading huge amount of images
// autorelease the bitmap context
// and all vars to help system to free memory
// when there are memory warning.
// on iOS7, do not forget to