This is a question related to this one.
When remove object from a mutable array, I noticed that there might be a 'retain' message sent to that object, so I searched out the above question, where w.m gave an answer mentioned that the internal implementation of NSMutableArray might first retain object, then release it twice when remove that object.
My question is that: Is there any evidence for this? Or anybody know any related details?
I met this issue when I was analyzing the following logs, I know there is something wrong with my code, but my concern is not about the bug itself, but whether it is a fact that 'there would be some retain
work when removeObject
'.
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc[299]: FREED(id): message retain sent to freed object=0x23f62a0
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x9a3694fd _objc_error + 116
1 libobjc.A.dylib 0x9a369533 __objc_error + 52
2 libobjc.A.dylib 0x9a36783a _freedHandler + 58
3 com.apple.CoreFoundation 0x9879a8cb -[NSMutableArray removeObject:range:identical:] + 331
4 com.apple.CoreFoundation 0x9879a770 -[NSMutableArray removeObject:] + 96