Memory Management Stanford CS193P iPhone Dev

Im not so clear on memory management; i understand what you create you must release, ok, but when?!  Because i just saw the MyTabBar example which creates ViewControllers, 3 of them i think, programatically, and a few lines down in the same m file, the delegate, the controllers get released.  Release means they get destroyed right?  I guess im not understanding conceptually what actually happens because to me, if you create in line 10 and release in line 20, even saying it sounds stupid to me, but its what i see, the user wont have time to use it :).

Or is it because they get created, then added to a new object, the tabbarcontroller, and therefore the individual instances created can be released because they are now part of the tabbarcontroller object which will be released some other time?

Leave a Reply