Retain, alloc, properties ... Topic to make your Obj-c life easier !

Posted by gotye on Stack Overflow See other posts from Stack Overflow or by gotye
Published on 2010-03-22T23:24:05Z Indexed on 2010/03/22 23:31 UTC
Read the original article Hit count: 252

Filed under:
|
|
|
|

Hey everyone,

The more I code, the more I get lost ... so I decided to create a topic entirely dedicated to the memory management for me (and others) not to waste hours understanding obj-c basics ... I'll update it as new questions are asked !

Okay below is some examples :

// myArray is property (retain)
myArray = otherArray;

//myArray isn't a property
myArray = otherArray;

//myArray is a property (retain)
myArray = [[NSArray alloc] init];

//myArray isn't a property
myArray = [[NSArray alloc] init];

Could you explain to me what happens in every cases ? And especially the number 3 ;)

Thanks for the time.

Gotye.

© Stack Overflow or respective owner

Related posts about retain

Related posts about allocation