I'm developing an app that stores a lot of images in the iPhone app, but it eats a lot of memory storage.
As a result, the operation will slow down or fall.
What should I be aware of when I store a large amount of images in the app?
Please give me some advice.
Try to initialize the object you used once and program it with the awareness that you don't store trash in your memory.
Use UICollectionView, UITableView, etc.
The resulting View is reused to reduce memory consumption.
Avoid leaving references to the data to be saved (NSData) and open immediately after saving the file.
Avoid keeping the entire data content in the instance.
Enclose the loop with @autoreleasepool when retrieving data or saving files in loop processing.
There are more than a few things to be careful about, but it's also important to know where the problem is.
You can use the Profile tool included with Xcode to visualize memory usage.
Let's find out where memory consumption is actually increasing.
Don't mention memory leaks. Let's crush them.
© 2024 OneMinuteCode. All rights reserved.