DevPrep

All topics › Memory management

ARC

Junior PRO

Essence

ARC (Automatic Reference Counting) is a compiler mechanism that inserts the retain/release calls in the right places for you. The programmer describes ownership (strong/weak/unowned); the actual reference counting happens at run time. It is the current model for both Objective-C (since 2011) and Swift — Swift never had any other model.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store