December 2015
Intermediate to advanced
400 pages
13h 3m
English
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.
The memory allocation and management for value types – enumerations and structures – is very simple. When you create a new instance ...
Read now
Unlock full access