18
Memory Management
For many years, the primary languages that I used were C and C-based object-oriented languages. These languages required a good handle on managing memory and knowing when to release memory. Luckily, modern languages like Swift take care of managing memory for us. However, it is a good idea to understand how this memory management works so we can avoid the pitfalls that cause this memory management to fail.
In this chapter, we will learn:
- How ARC works
- What a strong reference cycle is
- How to use weak and unowned references to prevent strong reference cycles
As we saw in Chapter 17, Custom Value Types, structures are value types and classes are reference types. What this means is that when we pass an instance of a structure ...
Get Mastering Swift 5.3 - Sixth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.