AnthonyWhitakerJr / WFReliquary

Companion app for Warframe game. Allows users to anticipate results of fissure missions.
1 stars 1 forks source link

Handle memory warnings. #42

Open AnthonyWhitakerJr opened 7 years ago

AnthonyWhitakerJr commented 7 years ago

Clear objects from context that are not immediately relevant.

Leaving Everything in Memory As you focus on functionality and features, it’s easy to forget the less glamorous topics like keeping memory usage low. The temptation to release an application before a good round of performance testing, especially when you’re on a deadline, can sometimes be too much. Luckily it’s pretty easy to put steps in place to help keep memory usage low.

When you work with managed objects, you do so in memory using a managed object context. Once you’re finished with managed objects, you should remove them from memory by calling one of the following NSManagedObjectContext instance methods:

Use reset to remove all managed objects from a context Use refreshObject:mergeChanges and pass NO to remove a specific object from a context Using either of those methods will ensure that unused objects aren’t floating around wasting space. To increase your visibility of the number of objects in a context, log the results of [[context registeredObjects] count] to the debug console regularly.