1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
<0xbfffdd44>: 4
// stack address, int primitive type (4)
<0xbfffdd40>: 8
// stack address, int primitive type (8)
<0xbfffdd2c - 0x7180120>: mutable string 1 [1]
// pointer (stack) and object (heap) addresses, NSMutableString object ("mutable string 1")
<0xbfffdd20 - 0x7180160>: __block mutable string 1 [1]
// pointer (stack) and object (heap) addresses, NSMutableString object ("__block mutable string 1")
*** BLOCK CALLED ***
<0xbfffdcf4>: 4
// stack address, int primitive type (4), int value copied inside the block at declaration time as const
<0xbfffdd40>: 8
// stack address, int primitive type (8), inside the block there is a reference to it
<0xbfffdcfc - 0x7180120>: mutable string 1 [1]
// pointer (stack, copied in block as const) and object (heap) addresses, NSMutableString object ("mutable string 1") not retainded since the block resides on the stack
<0xbfffdd20 - 0x7180160>: __block mutable string 1 [1]
// pointer (stack, reference to pointer copied in block) and object (heap) addresses, NSMutableString object ("__block mutable string 1") not retained
<0xbfffdc10>: 4
// stack address, int primitive type (4), int arg passed by value inside the block
<0xbfffdc0c>: 8
// stack address, int primitive type (8), int arg passed by value inside the block
<0xbfffdc18 - 0x71b3810>: mutable string 1 [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("mutable string 1")
<0xbfffdc14 - 0x71b3850>: __block mutable string 1 [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("__block mutable string 1")
*** BLOCK CALL ENDED ***
*** BLOCK <0xbfffdce0> [1] ***
*** COPIED BLOCK <0x759aa90> [1] ***
// block copied to the heap
*** BLOCK CALLED ***
<0x759aaa4>: 4
// heap address, int primitive type (4), int value copied inside the block at declaration (copy) time as const
<0x759aa60>: 8
// heap address, int primitive type (8), inside the block there is a reference to it (int copied to the heap due to [block copy])
<0x759aaac - 0x7180120>: mutable string 1 [2]
// pointer (heap, copied in block) and object (heap) addresses, NSMutableString object ("mutable string 1") retained since this block now lives on the heap
<0x759aa88 - 0x7180160>: __block mutable string 1 [1]
// pointer (heap, reference to pointer copied in block) and object (heap) addresses, NSMutableString object ("__block mutable string 1") not retained
<0xbfffdc10>: 4
// stack address, int primitive type (4), int arg passed by value inside the block
<0xbfffdc0c>: 8
// stack address, int primitive type (8), int arg passed by value inside the block
<0xbfffdc18 - 0x7180120>: mutable string 1 [2]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("mutable string 1")
<0xbfffdc14 - 0x7180160>: __block mutable string 1 [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("__block mutable string 1")
*** BLOCK CALL ENDED ***
<0xbfffdd44>: 42
// stack address, int primitive type (4)
<0x759aa60>: 108
// heap address, int primitive type (8) (int copied to the heap due to [block copy])
<0xbfffdd2c - 0x755a580>: mutable string 1 replaced [1]
// pointer (stack) and object (heap) addresses, NSMutableString object ("mutable string 1 replaced")
<0x759aa88 - 0x75595a0>: __block mutable string 1 replaced [1]
// pointer (stack) and object (heap) addresses, NSMutableString object ("__block mutable string 1 replaced")
*** BLOCK CALLED ***
<0xbfffdcf4>: 4
// stack address, int primitive type (4), int value copied inside the block at declaration time
<0x759aa60>: 108
// heap address, int primitive type (8), inside the block there is a reference to it (int copied to the heap due to [block copy])
<0xbfffdcfc - 0x7180120>: mutable string 1 [2]
// pointer (stack, copied in block as const) and object (heap) addresses, NSMutableString object ("mutable string 1") (retained)
<0x759aa88 - 0x75595a0>: __block mutable string 1 replaced [1]
// pointer (stack, reference to pointer copied in block) and object (heap) addresses, NSMutableString object ("__block mutable string 1 replaced") (not retained)
<0xbfffdc10>: 42
// stack address, int primitive type (4), int arg passed by value inside the block
<0xbfffdc0c>: 108
// stack address, int primitive type (8), int arg passed by value inside the block
<0xbfffdc18 - 0x755a580>: mutable string 1 replaced [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("mutable string 1 replaced")
<0xbfffdc14 - 0x75595a0>: __block mutable string 1 replaced [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("__block mutable string 1 replaced")
*** BLOCK CALL ENDED ***
*** BLOCK CALLED ***
<0x759aaa4>: 4
// heap address, int primitive type (4), int value copied inside the block at copy time as const
<0x759aa60>: 108
// heap address, int primitive type (8), reference to int value (copied to the heap due to [block copy])
<0x759aaac - 0x7180120>: mutable string 1 [2]
// pointer (heap, copied in block) and object (heap) addresses, NSMutableString object ("mutable string 1") (retained)
<0x759aa88 - 0x75595a0>: __block mutable string 1 replaced [1]
// pointer (heap, reference to pointer copied in block) and object (heap) addresses, NSMutableString object ("__block mutable string 1 replaced") (not retained)
<0xbfffdc10>: 42
// stack address, int primitive type (4), int arg passed by value inside the block
<0xbfffdc0c>: 108
// stack address, int primitive type (8), int arg passed by value inside the block
<0xbfffdc18 - 0x755a580>: mutable string 1 replaced [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("mutable string 1 replaced")
<0xbfffdc14 - 0x75595a0>: __block mutable string 1 replaced [1]
// pointer (stack, arg pointer value used inside the block) and object (heap) addresses, NSMutableString object ("__block mutable string 1 replaced")
*** BLOCK CALL ENDED ***
|