Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do IOS programmers handle the lack of garbage collection in IOS?

 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my dabbling and learning IOS development, the biggest problem that I expect my code will have is memory leaks. I can understand that as a very limited embedded computer, its an engineering tradeoff of features vs memory/time/code/bugs/... but the idea of a programmer managing his own memory makes me shudder.

How do folks really handle this?
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Memory management in iOS isn't that bad or difficult, retain and release policy is really clear. Maybe we are spoiled by garbage collected languages.
All you need are three or four rules when it comes to memory management, crystal clear.
 
nik gen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can found and solve your memory leaks using Static Analyzers and with Instrument tools.
Using Build and Static Analyze, you will get all the possible leaks in your code at compile time.
Using Instrument tools, you can find run time leaks. These are very useful to handle memory management.

Thanks,
Niketa.
 
Raja Pal
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the iOS 5 you can handle garbage collection by exploiting features like Automatic Reference Counting - ARC which allows you to track the reference count of variables and thus collect them.
 
nik gen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja,

Thats a good features in iOS 5.
But in lower versions as well as in iOS 5, the build and analyze and Instrument tool is very useful. ARC is one more feature to handle memory after iOS 5.

Thanks,
Niketa.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic