O'Reilly logo

iOS and macOS™ Performance Tuning: Cocoa®, Cocoa Touch®, Objective-C®, and Swift™ by Marcel Weiher

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

7. Memory: Pitfalls and Techniques

The most common techniques for memory optimization revolve around the use of more compact data structures, and this chapter will definitely discuss that topic. In addition, we will show some pitfalls, especially those common in Objective-C code. (Did you guess that some of them involve use of Foundation objects?)

Of course, we also need to have a look at leak avoidance, and the special role that reference counting plays here for both Objective-C and Swift reference types, as well as the alternative of passing values around instead of references. We will look at Objective-C caching techniques and APIs, as well as APIs for controlling the mapping of address space to real memory.

We will continue our theme of the ...

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