iOS: helpfulness of didReceiveMemoryWarning:

前端 未结 4 2100
予麋鹿
予麋鹿 2020-12-05 11:47

I\'m at the part of my development process for tracking down crashing and memory leaks. As a strategy, do you put any NSLog messages or notifications of some such into

4条回答
  •  无人及你
    2020-12-05 12:24

    The purpose of didReceiveMemoryWarning is to give you a chance to free memory or pop views to avoid a crash. You will not receive it at any predictable point because it depends on what the user is doing. For example, if the user is listening to the iPod, there is less available memory and you will receive it sooner.

    The general rule of thumb is that you have about 8MB of RAM to work with. When you get close to that you can expect the event to be raised. If you are taking up that much RAM deliberately you should have a plan to do something about it.

提交回复
热议问题