Derived layer members


I should start to say that I am relatively new to cocos2dx and derived classes. However… I have a derived class from cocos2d::layer (class World : public cocos2d::Layer). This class has a few private members that needs to be deleted when application exits. I create them using new and std::vector resize/push_back. How do I free them when the app closes, that is when the user double-clicks home button and presses “-”. I feel uneasy when I haven’t called delete or clear() appropriately.

Ideally I would like to have something along the lines of:

    delete mPlayer;

I’ve read this tutorial which mentions how I should initialize, create and release my objects. But my destructors never gets called when shutting down the app. Thanks for reading, Any advice appreciated.