Memory leaks using the Xcode memory graph debugger

Steven Curtis
5 min readMay 22, 2019

Memory leaks can be thought of as memory that is allocated, but never released (and then no longer used by the App). When there are no references to a block or section of memory, there is no way to release it an it can’t be used again.

Prerequisites:

  • Reference and value types
  • MVVM architecture

Terminology

Instruments: Instruments are a set of application performance analyzes and visualizers integrated into Xcode.

Memory leak: A memory leak is a portion of memory that will never be used, yet is held onto forever. It is both a waste of space and can cause problems.

Memory footprint: the amount of memory that a program uses or references. The more resources that are used, the larger the footprint. If objects are not released the occupied memory will grow, leading to memory warning and crashes.

Automatic Reference Counting (ARC): ARC is a memory management feature (of the Clang compiler) that provides the reference counting for both Objective-C and Swift. The references may be weak or strong, and when a strong reference is declared the counter increases by one. Upon release, the counter decreases by 1 and when the reference count is 0 ARC can deallocate it from the memory heap (as it…

--

--

Responses (1)