【发布时间】:2014-11-13 17:17:14
【问题描述】:
在我的 iOS 应用程序中实现了从网络保存视频。下载视频时,它会不断增加内存使用量。我在 xcode 中使用配置文件进行了检查,发现每个视频都有一些 malloc 增加。
我不熟悉个人资料。我已经发布了 receivedData NSMUtableData 变量。
- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectry = [paths objectAtIndex:0];
NSLog(@"Succeeded! Received %d bytes of data",[receivedData length]);
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSString *filename = [NSString stringWithFormat:(@"video_%@.mp4"),videoURL];
[receivedData writeToFile:[documentsDirectry stringByAppendingPathComponent:filename ] atomically:YES];
receivedData = nil;
[receivedData release];
progress.hidden = YES;
}
应用程序的性能下降。我该如何解决这个问题。
【问题讨论】:
标签: ios objective-c memory-management memory-leaks malloc