I was trying to understand memory management concept, and start digging from Apple docs and many articles regarding Memory management in Objective-C. When I start searching from Apple docs I was send back to object copying and messaging concept.
While reading about copying object I hit one question and I was trying to find the solution but fail to get satisfactory solution. It will be honor if someone will help me out. Question is:
array1 = {obj1,obj2,obj3}
array2 = {obj4,obj5,obj6}
array2 = array1 -- Shallow Copy
What happened to the memory which was associated with array2? How to release if there is a leak? What is better practice to perform such shallow copy in ARC and NonARC environment?