Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Cover
Title
Copyright
Contents at a Glance
Contents
About the Author
About the Translator
About the Technical Reviewers
Acknowledgments
Introduction
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
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
__weak ownership qualifier
__unsafe_unretained ownership qualifier
__autoreleasing ownership qualifier
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
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
__blockspecifier
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
Anonymous Function
Writable Variables
Static or Global Variables
__block specifier
Memory Segments for Blocks
A Block as NSConcreteGlobalBlock Class Object
Block on the Heap
Copying Blocks Automatically
Coping Blocks Manually
Copying Block Multiple Times
Memory Segments for __block Variables
__forwarding
Capturing Objects
When You Should Call the “copy” Method
__block Variables and Objects
Circular Reference with Blocks
Copy/Release
Summary
Chapter 6: Grand Central Dispatch
Grand Central Dispatch Overview
Multithreaded Programming
How a CPU Executes an Application
Advantages and Disadvantages of Multithreaded Programming
Summary
Chapter 7: GCD Basics
Dispatch Queues
Two Types of Dispatch Queue
Serial Dispatch Queue
Concurrent Dispatch Queue
Obtaining Dispatch Queues
dispatch_queue_create
Main Dispatch Queue/Global Dispatch Queue
Controlling Dispatch Queues
dispatch_set_target_queue
dispatch_after
Dispatch Group
dispatch_barrier_async
dispatch_sync
dispatch_apply
dispatch_suspend/dispatch_resume
Dispatch Semaphore
dispatch_once
Dispatch I/O
Summary
Chapter 8: GCD Implementation
Dispatch Queue
Kernel-Level Implementation
GCD Structure
Global Dispatch Queue and pthread_workqueue
Executing Blocks
Dispatch Source
Example Using Dispatch Source
Summary
Appendix A: Example of ARC, Blocks, and GCD
Appendix B: References
References for ARC
Transitioning to ARC Release Notes
ARC Programming Guide by Apple
LLVM Document—Automatic Reference Counting
Advanced Memory Management Programming Guide
Getting Started: Building and Running Clang
objc4 version 493.9
GNUstep libobjc2 version 1.5
References for Blocks
APPLE’S EXTENSIONS TO C
BLOCKS PROPOSAL, N1451
Presentation About Blocks
Language Specification for Blocks
Block Implementation Specification
libclosure version 53
plblocks
References for Grand Central Dispatch
libdispatch version 187.5
Libc version 763.11
xnu version 1699.22.81
libdispatch project page
libdispatch Porting Project
Index
← Prev
Back
Next →
← Prev
Back
Next →