does copy/mutableCopy operation increment retain count value ?? (Objective C)
The normal semantics of copy
and mutableCopy
are to give you back a retained object, just like creating a new one via alloc
/init
would have. They don't increment the reference count of the object being copied, if that's what you're asking. From the NSObject
documentation for copy
:
If you are using managed memory (not garbage collection), this method retains the new object before returning it. The invoker of the method, however, is responsible for releasing the returned object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With