I am creating an application that will extract image resources and text from a web service. I choose the excellent category AFNetworking UIImageView + AFNetworking for working with image loading.
However, I ran into a memory issue. I used the Distribution Tools tool , every time I upload more images, the memory size of 1-2 MB will always increase. I was tracking the source code, it turned out to be in the AFNetworking code.
Exact line of code:
- (void)connectionDidFinishLoading:(NSURLConnection *)__unused connection {
self.responseData = [self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey];
[self.outputStream close];
[self finish];
self.connection = nil;
}
This will take 99.6% of the memory allocation.
I custom ARC in the project, display the UIImageViews in a UITableView and configure the cell as the following code:
[self.imageView setImageWithURLRequest:request
placeholderImage:nil
success:successBlock
failure:failBlock];
- - ? , , , . 100 .
! !