Abstract
In the previous chapters, we learned that a Block is an anonymous function together with automatic variables. In this chapter, we look at the details of a Block with its implementation to see what happens under the hood of Blocks. We start with the basic idea of the Block’s implementation and then we show various situations to see how the Blocks work, such as how automatic variables are captured, how Blocks and __block variables are stored in memory, and how objects are captured by Blocks. Also, we show some pitfalls of Blocks related to circular reference and copy/release methods. All the example source code assumes ARC is enabled except where specified.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2012 Kazuki Sakamoto
About this chapter
Cite this chapter
Sakamoto, K., Furumoto, T. (2012). Blocks Implementation. In: Pro Multithreading and Memory Management for iOS and OS X. Apress. https://doi.org/10.1007/978-1-4302-4117-1_5
Download citation
DOI: https://doi.org/10.1007/978-1-4302-4117-1_5
Publisher Name: Apress
Print ISBN: 978-1-4302-4116-4
Online ISBN: 978-1-4302-4117-1
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)