I have the following code in a function in my .m file:
desc = [my executeFunction]; // desc is returned by executeFunction
data = [desc objectAtIndex:0]; // data is declared in the .h file
data2 = [desc objectAtIndex:1];
[myTextField setString:data]; // myTextField is connected to an NSTextView in IB
How am I supposed to be writing the 4th and 5th lines? How / where do I release data and data2?
You don't. You haven't received
data2 from a method with a selector containing
copy or a function with a name containing
Create, so you are not responsible for releasing them.
Have a look at http://boredzo.org/cocoa-and-cocoa-touch-intro/.
Revise the Cocoa Memory Management Guidelines and determine whether releasing is necessary in this case. There are very specific, yet very simple rules regarding a
release pattern. Commit these rules to memory (pun intended).