iOS: helpfulness of didReceiveMemoryWarning:

前端 未结 4 2098
予麋鹿
予麋鹿 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:38

    OK, several things to note:

    • didReceiveMemoryWarning will be called before an out-of-memory crash. Not other crashes. If you handle the warning properly and free up memory, then you can avoid the out-of-memory condition and not crash.
    • You can manually trigger a memory warning in the simulator under the Hardware menu. Highly recommend doing this to test your handling of didReceiveMemoryWarning.
    • Instruments helps you debug leaks (though not all of them) - it's not really that useful for crashes.
    • No, I don't personally use NSLog - I just breakpoint the memory warnings when I'm debugging.

提交回复
热议问题