If you're using the @synthesize directive to create the property accessors, the compiler will also create any ivars that you leave out of the class declaration. You do still need to release your ivars. It used to be that you couldn't access synthesized ivars directly and so had to use the property setter in your -dealloc method like this:
- (void)dealloc
{
self.obj = nil;
self.str = nil;
[super dealloc];
}
These days, though, the compiler will let you access the synthesized ivar directly, so you can release it instead of calling the setter (which is a good idea in -dealloc, and a bad idea everywhere else):
- (void)dealloc
{
[obj release];
[str release];
[super dealloc];
}
This will change when you eventually convert your code for ARC (automatic reference counting) because the compiler will take care of releasing your ivars in -dealloc for you. Most of the time, this means that your -dealloc implementation can just go away.