>> “is that any method in CCLayer class that I should use to release the objects? You know… I mean - the ‘special’ method, which would be done at the end of the program - is it right to overload the destroy() method in CCLayer class, or should I avoid doing this?”
I’ve found the destroy() method to be a very bad way to release objects. More often than not, the method isn’t even called, even when an object is released through the autorelease pool. I don’t know if this behavior is by design or not, but it sure adds a lot of memory leaks if you’re not aware of it. It’s probably better to ignore destroy() and use the destructor instead.
The system seems to be built with the idea of having everything based on NS/CCObject. If you’re not using CCObject everywhere and you’re mixing it up with custom memory management, things will get iffy. Therefore, initializing at onEnter and deiniting at onExit seems to be the better way if you don’t want to be leaking memory at CCLayer.
(to Walzer and his team: feel free to correct me I’m just basing my opinion on hours and hours of hunting down memory leaks)