IPhone memory management didReceiveMemoryWarning

Ok ......

I am implementing a simple OpenGL ES application on the iPhone, and I recently added it to Pinch Media Analytics. This helped to identify the problem of memory management, and I'm not quite sure how to deal with it.

In an ideal world, my application, which downloads PNG and .CAF files in the didFinishLoading file, starts, downloads all its resources and works fine.

HOWEVER, if my program gets into an emergency (which happened when I integrated Pinch Media libraries), or if I launch Safari and open a bunch of pages and then start my game, the game will return to the menu because it is from memory.

This problem will persist until I do a hard reset of the system.

The default answer that you chose online is to implement the didReceiveMemoryWarning method, as described below.

- (void)didReceiveMemoryWarning
{ 
  // default behavior is to release the view if it doesn't have a superview.

  // remember to clean up anything outside of this view scope, such as
  // data cached in the class instance and other global data.
  [super didReceiveMemoryWarning];
}

But this does not help, since other programs that are stored in memory are not mine. I do not want to let out my own look? Is there a good description of how to handle this situation and / or what happens in the didReceiveMemoryWarning event?

+3
source share
3 answers

If you have only one view, then the only thing you can do is to free all the data that you are not using, and lazy to download it later.

, , . , setView: nil. , IBOutlet, , xib.

, , -OpenGL ES , > 6 , 4 , , nil - , , .

, , , . , - .

+2

VM... , (, , , ). , , , , .

, . . , ; . Mutable , . NSStrings, .

, UIImage +imageNamed: , , , . , , .

"". , .

. , , . .

+5
0

Source: https://habr.com/ru/post/1709309/


All Articles