几秒钟或几分钟后Cocos2d-x崩溃

时间:2014-07-03 05:41:37

标签: android cocos2d-x

使用Cocos2d-x开发的游戏在使用几分钟后崩溃。这个错误在iOS中不会发生,但在Android中发生在Dalvik和ART中,无论是设备还是Android版本。

这里有很多深入的阅读,但我没有找到答案。

它看起来像是内存泄漏,但我不确定。这个游戏有很多资源,根据设备,它需要或多或少的时间来崩溃。所有这些都与de evil的信号3有关,Dalvik和ART发送给应用程序,因为它没有回答,生成的报告毫无意义。

啊,它总是在精灵变为notVisible时发生,但它随机发生。

我可以配置Cocos2d-x的内存管理吗?我可以配置Dalvik的垃圾收集器吗?

有没有想过要开始?

提前致谢。

这是Cocos2d-x输出报告(编辑为有趣的人)

Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'google/hammerhead/hammerhead:4.4.4/KTU84P/1227136:user/release-keys'
pid: 26249, tid: 26287, name: Thread-5259  >>> jp.co.secretcompany.misteriousname <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
Stack frame #00  pc 000116cc  /system/lib/libc.so (dlfree+1191)
Stack frame #01  pc 0000dc0b  /system/lib/libc.so (free+10)
Stack frame #02  pc 0020dd13  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCComponentContainer::~CCComponentContainer()+10): Routine ~CCComponentContainer at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/support/component/CCComponentContainer.cpp:41 (discriminator 1)
Stack frame #03  pc 001dd3f1  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCNode::~CCNode()+220): Routine ~CCNode at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/base_nodes/CCNode.cpp:143 (discriminator 2)
Stack frame #04  pc 001894d9  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (StoreListCell::~StoreListCell()+28): Routine ~CCTableViewCell at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/extensions/GUI/CCScrollView/CCTableViewCell.h:37 (discriminator 1)
Stack frame #05  pc 00189501  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (StoreListCell::~StoreListCell()+4): Routine ~StoreListCell at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/jni/../../Classes/Game/StoreListCell.cpp:114
Stack frame #06  pc 001e07b5  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCObject::release()+16): Routine cocos2d::CCObject::release() at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCObject.cpp:86 (discriminator 1)
Stack frame #07  pc 00208897  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::ccArrayRemoveAllObjects(cocos2d::_ccArray*)+16): Routine cocos2d::ccArrayRemoveAllObjects(cocos2d::_ccArray*) at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/support/data_support/ccCArray.cpp:188
Stack frame #08  pc 002088ad  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::ccArrayFree(cocos2d::_ccArray*&)+10): Routine cocos2d::ccArrayFree(cocos2d::_ccArray*&) at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/support/data_support/ccCArray.cpp:52
Stack frame #09  pc 001e0ffd  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCArray::~CCArray()+16): Routine ~CCArray at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCArray.cpp:374
Stack frame #10  pc 001e1015  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCArray::~CCArray()+4): Routine ~CCArray at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCArray.cpp:375
Stack frame #11  pc 001e07b5  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCObject::release()+16): Routine cocos2d::CCObject::release() at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCObject.cpp:86 (discriminator 1)
Stack frame #12  pc 001dd3d7  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCNode::~CCNode()+194): Routine ~CCNode at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/base_nodes/CCNode.cpp:139 (discriminator 1)
Stack frame #13  pc 001ee9df  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCLayer::~CCLayer()+78): Routine ~CCLayer at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp:64
Stack frame #14  pc 001eec1d  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCLayer::~CCLayer()+4): Routine ~CCLayer at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp:64
Stack frame #15  pc 001e07b5  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCObject::release()+16): Routine cocos2d::CCObject::release() at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCObject.cpp:86 (discriminator 1)
Stack frame #16  pc 00208897  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::ccArrayRemoveAllObjects(cocos2d::_ccArray*)+16): Routine cocos2d::ccArrayRemoveAllObjects(cocos2d::_ccArray*) at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/support/data_support/ccCArray.cpp:188
Stack frame #17  pc 002088ad  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::ccArrayFree(cocos2d::_ccArray*&)+10): Routine cocos2d::ccArrayFree(cocos2d::_ccArray*&) at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/support/data_support/ccCArray.cpp:52
Stack frame #18  pc 001e0ffd  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCArray::~CCArray()+16): Routine ~CCArray at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCArray.cpp:374
Stack frame #19  pc 001e1015  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCArray::~CCArray()+4): Routine ~CCArray at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCArray.cpp:375
Stack frame #20  pc 001e07b5  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCObject::release()+16): Routine cocos2d::CCObject::release() at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/cocoa/CCObject.cpp:86 (discriminator 1)
Stack frame #21  pc 001dd3d7  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCNode::~CCNode()+194): Routine ~CCNode at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/base_nodes/CCNode.cpp:139 (discriminator 1)
Stack frame #22  pc 001ee9df  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::CCLayer::~CCLayer()+78): Routine ~CCLayer at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp:64
Stack frame #23  pc 001b1ac5  /data/app-lib/jp.co.secretcompany.misteriousname-1/libgame.so (cocos2d::extension::CCScrollView::~CCScrollView()+60): Routine ~CCScrollView at /Users/misterunknow/Documents/secretcompany/misteriousname/Project/android/../libs/extensions/GUI/CCScrollView/CCScrollView.cpp:65

2 个答案:

答案 0 :(得分:0)

我们在第一场比赛中遇到了同样的问题,问题是

  

我们没有释放我们保留的物品。

一段时间后,由于内存错误导致崩溃。完成该场景或图层后,检查您的对象是否正在被销毁。我更喜欢使用CCSprite:create方法,因为它创建了一个自动释放对象,您不必担心手动释放它。

以下是一些链接,可以让您更深入地了解它。

Cocos2dx memory management, how to use destructors and when to release obejcts?

Memory deallocation in Cocos2d-x

答案 1 :(得分:0)

所有问题似乎与在早期版本的Cocos2d-x上处理CCLabelTTF的错误有关,特别是如果您使用奇怪的字符和字体,例如日语。

如果你在滚动的表格中分配了很多标签,就会引发随机崩溃。

感谢您的帮助。