Please see this page for a good explanation. Particularly subpage # 7
each saves another created memory object. so let's see what we have:
in getASprocket :
sprocket = [[Sprocket alloc] init];
+ 1
return [sprocket retain];
+ 1
and according to your method:
ivarSprock = [sprock retain];
+ 1
[sprock release]
1
What do we do ? Well, we have to let Sprock go by making it an abstract:
return [[[Sprocket alloc] init] autorelease]
:
. , dealloc.