This is probably one of the hardest things to get used to on the iPhone.
It helps to keep in mind that you must release something after you have used "alloc" when your create an object. This is usually used with "init" to create instances of an object. What gets confusing is that some classes have functions that do the same thing.
For example, check out the difference between these two ways to create a string:
NSString *string1 = [[NSString alloc] initWithString:@"needs to be released"];
NSString *string2 = [NSString stringWithString:@"no need to release"];
Both these things do the same thing but you do not need to worry about releasing the second one because you can assume that it is "autoreleased". It is a sort of unspoken rule that situations like string2 above are autoreleased while string1 will need to be explicitly released.
At any rate, this is clearly a complex issue. What I used to help me deal with this problem was that I bought a video (think it was about 10 bucks) from the Mac Developer Network that tells you everything you need to know about memory management.
Mac Developer Network » Blog Archive » Memory Management in Objective-C
They do a much better job of dealing with this problem then the Apple documentation does and they have some tips on how to cope with memory management. Highly recommend it.