Table of Contents
The Hidden Mystery Behind What Exactly Makes Ios More Efficient?
One of the biggest efficiencies in iOS compared to Android is memory management.
iOS uses a memory management technique called ‘automatic reference counting.’ Android uses a technique called ‘garbage collection.’
Garbage collection requires no special skill on the developer’s part. The developer doesn’t have to do anything in particular. Periodically, the operating system stops running apps and cleans up unused memory.
It’s easy, for developers, but it’s extremely inefficient, and the more memory is used the less efficient it becomes. All other things being equal, a system that uses garbage collection requires 2–4 times as much RAM as a system using reference counting for the same performance from the same applications.The Truth About What Exactly Makes Ios More Efficient? In 3 Little Words
The Ultimate Secret Of What Exactly Makes Ios More Efficient?
Reference counting is far more efficient but requires more discipline from developers. It’s not “fire and forget” memory management; developers are responsible for memory management in their apps. Developers allocate memory for objects, and mark those objects as either being in use or being no longer necessary. When you’re finished with an object in memory, it’s your responsibility to mark it with a “release” tag, which tells the operating system you’re no longer using it and that memory can be reclaimed.
Apple developed automatic reference counting (ARC) as part of their Objective-C (and later Swift) compilers. Automatic reference counting does what it says on the tin—it’s reference counting the developer doesn’t have to pay attention to.
What Everyone Ought To Know About What Exactly Makes Ios More Efficient?
With automatic reference counting, your compiled code notices when an object is no longer being used, and automatically tags it with a “release” tag. This gives you the efficiency of reference counting without the hassle of having to do your own memory management.
That doesn’t mean the developer can completely ignore memory. A clever developer bent on mischief can still screw things up even with automatic reference counting. If a developer creates two objects A and B, and A references B while B references A, they’ll never be deallocated even if nothing else references either one. Though if you’re doing this, it might be time to re-consider your life choices.
You, Me And What Exactly Makes Ios More Efficient?: The Truth
Why isn’t ARC used outside the Apple sphere, in spite of its ease of use and how radical the efficiency gain is over GC? I don’t know.