Get Updates By E-mail 

Article Written By:
Johann Dowa

Easy Guide For Proper Objective-C Memory Management

  •  
  •  
  •  
  •  
  •  

Memory management can be tricky in Objective-C.

If you don’t follow some solid principles for memory management it’s easy to get lazy, and then you can quickly find yourself getting stuck for hours checking every retain and release statement.

Even worse is if you’re going through someone else’s code, and they messed things up. Going through to fix memory management in someone else’s code can take forever.

A great tool that I’ve found for making this easier is Clang which works well with an interface such as this one: Clang GUI For Mac OS X.   You can also use SHIFT-CMD-A (build & analyze) in Xcode to bring up clang alerts.  Clang will notify you of any reference count problems, and syntactical mistakes that could lead to messed up memory management.  Even with Clang you can still run into problems.

Fortunately, Brent Simmon has written a great easy to follow guide on some simple principles to follow to alleviate memory problems before they start: How I Manage Memory.  It’s a good read and will help you to eliminate problems before they start.

[Source: Brent Simmon]
[Via: @rwenderlich]


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments