Objective c, Memory management of instance members

First you should not look at the retaincount, it not really reliable.

Second your property is set to retain. So when you assign some thing to it, it will increase the reatincount. As will alloc.

Doing it like this you are leaking:

self.detailedResultsMapViewController = [[DetailedResultsMapViewController alloc] initWithNibName:@"DetailedResultsMapViewController" bundle:nil];

you should do:

DetailedResultsMapViewController *vc = [[DetailedResultsMapViewController alloc] initWithNibName:@"DetailedResultsMapViewController" bundle:nil];
self.detailedResultsMapViewController =vc;
[vc release], vc= nil;

Or use Autorelease:

self.detailedResultsMapViewController = [[[DetailedResultsMapViewController alloc] initWithNibName:@"DetailedResultsMapViewController" bundle:nil] autorelease];

Using the property and synthesize gives you a new method. In this instance, you would have a new set and get method for the detailedResultsTableViewController. This is generated for you when you compile (ie there is no code that you have to add)

This set method will be

- (void)setDetailedResultsTableViewController:(DetailedResultsTableViewController *)c 
{
    if (detailedResultsTableViewController != nil) 
    {
        [detailedResultsTableViewController release];
        detailedResultsTableViewController = nil;
    }
    detailedResultsTableViewController = [c retain];
}

So, when you call

self.detailedResultsMapViewController = [[DetailedResultsMapViewController alloc] init...];

What you are actually calling is

[self setDetailedResultsMapViewController:[[DetailedResultsMapViewControler...]]];

And so you are actually doing two retains. One where you are calling alloc...init. and then the other because you are implicitly calling the setDetailedResultsMapViewController which will then do a retain as well.

If you are using properties, you would use

DetailedResultsTableViewController *d = [[DetailedResultsMapViewController alloc] init...]
self.detailedResultsMapViewController = d;
[d release];

The benefit of this is that you don't have to remember to release the old object before assigning the new as the synthesized method does that for you. You can also just do

self.detailedResultsMapViewController = nil;

in your dealloc method and you won't have to worry if you have already released it elsewhere.

This is useful to know because you can override the set method by manually entering the code which allows you to do things when the objects are set.