Watching memory usage in iOS

后端 未结 7 945
你的背包
你的背包 2020-11-28 01:54

Is there any way to find out how much memory is available in iOS? I know that the system will pass low memory warnings when available memory gets low. However, my App has so

7条回答
  •  借酒劲吻你
    2020-11-28 02:11

    Actually each view controller has - (void)didReceiveMemoryWarning functions.

    - (void)didReceiveMemoryWarning
    {
        // Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    
        // Release any cached data, images, etc that aren't in use.
    }
    

    As suggested by the comments, you can release unused data under the comment. On the other hand, comment out [super didReceiveMemoryWarning]; to suppress memory warnings & auto release objects.

提交回复
热议问题