Delete saved heap memory in iOS by programmatically

How to delete saved heap memory in iOS by programmatically.

I have iOS application and in this application, I have integrated small cocos2dx game.

The issues I am facing while I move first time from app to game and game to app this time I am not having memory issues but when I move from second time from app to the game this time my application memory keep on increasing and after one minute game is crashing.

If anybody has experiences and interested in this topic,
any tips, suggestions or recommendation would be appreciated.

Thanks,
Jagdish

Before you get into the idea of deleting saved heap, you might probably want to know which part of your code that keeps allocating new memory.

If you’re using xcode, you could easily use instruments and check your memory allocations

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/CommonMemoryProblems.html#//apple_ref/doc/uid/TP40004652-CH91-SW1