While developing my app I have come to realize that the majority of my app crashes have arisen from poor memory management.
I understand I can print or log retain counts through NSLog (@"retain count is:%d",[myInstance retainCount]);
But isn't there a better, less manual method? Possibly a visual representation of your objects and instances?
answered. Cheers, Adam & Jason. :-)
Memory management in iOS was initially non-ARC (Automatic Reference Counting), where we have to retain and release the objects. Now, it supports ARC and we don't have to retain and release the objects. Xcode takes care of the job automatically in compile time.
16GB of RAM is the highest amount of RAM ever offered in an iPhone or iPad, and the 5GB limitation means that apps aren't able to utilize even half of what the iPad Pro has to offer.
As per Apple, a memory leak is: Memory that was allocated at some point, but was never released and is no longer referenced by your app. Since there are no references to it, there's now no way to release it and the memory can't be used again.
Use the Leaks and Object Allocation tools through XCode.
Run > Start with Performance Tool > ...
In addition to the other answers, I would highly recommend using clang to do a static memory analysis of your code. It won't catch every memory-management error, but it does catch quite a lot. If your chief problem seems to come from memory management errors, clang will go a long way toward finding those errors. Clang is free, at http://clang.llvm.org/
As Adam suggests, Instruments is a very useful tool for these kinds of things. It's fairly easy to use, but can be a bit overwhelming at first. I suggest perusing the Instruments User Guide as you get started. It's pretty easy to follow and is helpful until you've used Instruments for a while. Even without reading the guide, however, Instruments is still far easier and more intuitive than littering your code with NSLog() calls and trying to parse the output yourself ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With