Update:
I wrote a very simple download code:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSURLRequest* request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://xxxx.s3.amazonaws.com/products/ipad/xxxx.mp4"]];
for(int i=0; i<4; i++){
NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,[NSString stringWithFormat:@"xxxx%d.mp4",i]];
AFDownloadRequestOperation* operation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:filePath shouldResume:YES];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:NO];
[operation setShouldOverwrite:YES];
[operation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
NSLog(@"%f", ( totalBytesRead / (float)totalBytesExpected));
}];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"finished");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(error.description);
}];
[[NSOperationQueue mainQueue] addOperation:operation];
}
I wrote it in my projects viewDidLoad commenting out all other codes. Memory usage is still the same and increasing:
I created a new project, and I wrote exactly the same code in the new project. And the memory usage is:
Which is good. But I don't understand why it is different in the real project?