Wednesday, May 1, 2013

A neat little trick to check for memory leaks

There are several tools and methods to check for memory leaks in your iOS apps. This one is something I came across on the 200Monkeys site and loved for its simplicity. If you are using ARC, you will realize it is harder to track or fix memory leaks. This may not be useful all of the time but may come in handy in particular scenarios.

Suppose your app allocates multiple instances of a class and you trusted ARC to handle the deallocations of these objects when they are no longer needed. But after that, if you find that there are memory leaks in your app, the first thing you might want to check is if all those instances have been deallocated correctly. Just put the following code in the class whose instances you want to track:

Now just look for the 'Total freed' logs and you can figure out if all your instances have been freed.

1 comment:

  1. i want to share with you guy's you can create an application and games too to your Iphone and or ipad not only create apps but you earn money too its just sound great.To Discover How To Create An Iphone Or Ipad App&game just see the link