I would highly recommend you read through the memory management rules a few times. It's pretty short and not difficult, and once you've understood what's in that document, you won't ever have to wonder.
Basically, think of it as ownership. When you create an object with new
, copy
or alloc
, or when you retain an object, you own that object. An object will not go away as long as it has owners. When you're done with an object, you release
it, thus giving up your ownership. When the object has no more owners, it can go away and might be deallocated. Any object that you didn't new
, alloc
, retain
or copy
is not owned by you and can't be guaranteed to stay around past the current call chain (i.e., it's OK to use it or return it but not to store it for later use).