O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

24 Memory Management and ARC

All computer programs use memory. Most computer programs use memory dynamically: As a program runs, it allocates and deallocates memory as needed. Swift’s stance on memory management is relatively unique. Most memory issues are handled for you automatically, but Swift does not use a garbage collector (a common tool for automatic memory management in programming languages). Instead, Swift uses a system of reference counting. In this chapter, you will investigate how that system works and learn what you need to be aware of to avoid memory leaks.

Memory Allocation

The memory allocation and management for value types – enumerations and structures – is very simple. When you create a new instance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required