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

Autorelease pool blocks and threads


You will need to create your own autorelease pool if you are making Cocoa calls outside the main thread of the Application Kit. It may happen that you create a foundation-only application for example, or separate a thread.

If your application generates a large number of autoreleased objects, instead of maintaining a single autorelease pool, you are highly advised to drain the autorelease pool and create a new one frequently. This behavior is used by Application Kit on the main thread. If you neglect this, your autoreleased objects don't deallocate, growing the memory footprint. On the other hand, if your thread doesn't make Cocoa calls, you can easily ignore this advice.