Book Image

Objective C Memory Management Essentials

Book Image

Objective C Memory Management Essentials

Overview of this book

Table of Contents (18 chapters)
Objective-C Memory Management Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Caching


Caching is a concept where you store resources on disk or memory for faster access. Caching will occupy more space, but in situations where you need to worry more about loading speed than memory, caching can be a very good technique to use. Consider this common scenario:

  • Downloading a large file such as an image or even a movie

  • Write the file to a disk

  • Read the files from the disk and display them

If you follow the normal method as mentioned earlier, a bottleneck that you will face is slow loading of the file from disk. Disk access can be as slow as 10,000 or even 1,000,000 slower than memory access and it won't make a good user experience as the user will be kept waiting while your app is loading the files from disk. Caching will help slow this problem as your file is saved to memory where read access is faster.

This is good from a user point of view as they do not need to wait a long time for the file to be loaded and can help to optimize the user experience of your application since...