SimpleAudioEngine Cocos2d Leaking Memory

你说的曾经没有我的故事 提交于 2019-12-04 14:54:16

From the cocosdenshion FAQ:

What should I retain/release?

SimpleAudioEngine, CDAudioManager and CDSoundEngine APIs are all accessed through a shared singleton instance. This is a common pattern that is used throughout Cocoa Touch and cocos2d. The shared instance should not be retained or released.

If you need to completely shut down CocosDenshion and free all resources it was using then call the end method on the highest level API you are using. For example if you are using SimpleAudioEngine then just call [SimpleAudioEngine end].

If you use CDSoundSource objects you must obtain them through one of the factory methods such as soundSourceForFile. The CDSoundSource that is returned is autoreleased, that means if you want to use it outside the scope of the current method you must retain it. If you retain a CDSoundSource you should release it when you are finished using it.

are you using simulator to run the leak tools ? i encounter the same leak in simulator but not on device. try using device to run the leak tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!