Pro Multithreading and Memory Management for iOS and OS X [electronic resource] : with ARC, Grand Central Dispatch, and Blocks /
Sakamoto, Kazuki.author.
Furumoto, Tomohiko.author.
If you want to develop efficient, smooth-running applications, controlling concurrency and memory are vital. Automatic Reference Counting is Apple's game-changing memory management system, new to Xcode 4.2. Pro Multithreading and Memory Management for iOS and OS X shows you how ARC works and how best to incorporate it into your applications. Grand Central Dispatch (GCD) and blocks are key to developing great apps, allowing you to control threads for maximum performance. If for you, multithreading is an unsolved mystery and ARC is unexplored territory, then this is the book you'll need to make these concepts clear and send you on your way to becoming a master iOS and OS X developer. What are blocks? How are they used with GCD? Multithreading with GCD Managing objects with ARC.
Title Page; Copyright Page; Contents at a Glance; Table of Contents; About the Author; About the Translator; About the Technical Reviewers; Acknowledgments; Introduction; Preface; Who This Book Is For; Chapter 1 Life Before Automatic Reference Counting; Reference Counted Memory Management Overview; Exploring Memory Management Further; You Have Ownership of Any Objects You Create; You Can Take Ownership of an Object Using retain; When No Longer Needed, You Must Relinquish Ownership of an Object You Own; Relinquishing Ownership of a Retained Object; Relinquishing Ownership of a Retained Object
Returning a New Object Without OwnershipYou Must Not Relinquish Ownership of an Object You Don't Own; Implementing alloc, retain, release, and dealloc; The alloc Method; The retain Method; The release Method; The dealloc Method; Apple's Implementation of alloc, retain, release, and dealloc; Autorelease; Automatic Variables; Implementing autorelease; Apple's Implementation of autorelease; Summary; Chapter 2: ARC Rules; Overview; Reference Counting Mechanism Changes; Ownership qualifiers; __strong ownership qualifier; Assigning to __strong ownership qualified variables
How the strong reference works__weak ownership qualifier; Circular Reference; Self Reference; Weak Reference Disappears; __unsafe_unretained ownership qualifier; __autoreleasing ownership qualifier; Compiler Cares __autoreleasing Automatically; Returning a Result as the Argument; __strong and __weak; Rules; Forget About Using Retain, Release, RetainCount, or Autorelease; Forget About Using NSAllocateObject or NSDeallocateObject; Follow the Naming Rule for Methods Related to Object Creation; Forget About Calling dealloc Explicitly; Use @autoreleasepool Instead of NSAutoreleasePool
Forget About Using Zone (NSZone)Object Type Variables Cannot Be Members of struct or union in C Language; 'id' and 'void*' Have to Be Cast Explicitly; __bridge cast; __bridge_retained cast; __bridge_transfer cast; CFBridgingRetain function; CFBridgingRelease function; Property; Array; Summary; Chapter 3: ARC Implementation; __strong ownership qualifier; Calling the array method; Inside the array Method; __weak ownership qualifier; Looking Under the Hood When an Object Is Discarded; Assigning a Newly Created Object; Immediate Disposal of Objects; Adding to autorelease pool Automatically
__autoreleasing ownership qualifier__unsafe_unretained ownership qualifier; Reference Count; Summary; Chapter 4: Getting Started with Blocks; Blocks Primer; Anonymous functions; Variables; Blocks to the Rescue; Block Literal Syntax; Block type variables; Capturing automatic variables; __block specifier; Captured automatic variables; Summary; Chapter 5: Blocks Implementation; Under the Blocks' Hood; Converting Source Code; this in C++ and self in Objective-C; Declaring _cself; Constructor of __main_block_impl_0 struct; Initializing __main_block_impl_0 instance; Reviewing _NSConcreteStackBlock
Capturing Automatic Variables
Includes bibliographical references and index.
Includes index.
If you want to develop efficient, smooth-running applications, controlling concurrency and memory are vital. Automatic Reference Counting is Apple's game-changing memory management system, new to Xcode 4.2. Pro Multithreading and Memory Management for iOS and OS X shows you how ARC works and how best to incorporate it into your applications. Grand Central Dispatch (GCD) and blocks are key to developing great apps, allowing you to control threads for maximum performance. If for you, multithreading is an unsolved mystery and ARC is unexplored territory, then this is the book you'll need to make these concepts clear and send you on your way to becoming a master iOS and OS X developer. What are blocks? How are they used with GCD? Multithreading with GCD Managing objects with ARC.
iOS (Electronic resource)
Mac OS.
Apple computer.
Computers.
Apple and iOS.
Information Systems and Communication Service.