在发布未知对象期间cocos2dx在android上崩溃,在IOS上运行正常

时间:2015-11-20 06:33:25

标签: android memory-leaks android-ndk cocos2d-x cocos2d-x-3.0

我在cocos2dx-3.3上使用ndk-r10d eclipse,我的测试设备是三星Galaxy S3。 有一个派生自CClayer的类的对象添加到CCScene对象中。添加新图层并从场景中删除旧图层时,游戏崩溃。该图层具有TMXLayer对象作为子对象,其中添加了其他Node个对象,如TTFLabelNode等。

日食日志中的错误如下:

11-20 14:25:56.964: A/libc(23300): @@@ ABORTING: invalid address or address of corrupt block 0x6fa7dce8 passed to dlfree

11-20 14:25:56.964: A/libc(23300): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 23319 (Thread-5050)

可能的错误是当某个节点正在清除其子矢量并且矢量正在释放其元素时。

ndk崩溃转储显示:

********** Crash dump: **********
Build fingerprint: 'samsung/m0xx/m0:4.3/JSS15J/I9300XXUGND3:user/release-keys'
pid: 6306, tid: 6344, name: Thread-553  >>> com.playbuff.BOWFinal <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
Stack frame #00  pc 0001e824  /system/lib/libc.so
Stack frame #01  pc 0001c76c  /system/lib/libc.so (abort+4)
Stack frame #02  pc 000122ed  /system/lib/libc.so
Stack frame #03  pc 00010f9d  /system/lib/libc.so (dlfree+1184)
Stack frame #04  pc 0000dabf  /system/lib/libc.so (free+10)
Stack frame #05  pc 00782c4b  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (operator delete(void*)+8): Routine operator delete(void*) at /tmp/ndk-user/tmp/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_new_delete.cpp:144
Stack frame #06  pc 00456e47  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Sprite::~Sprite()+10): Routine cocos2d::Sprite::~Sprite() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./2d/CCSprite.cpp:296 (discriminator 2)
Stack frame #07  pc 00478997  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Ref::release()+30): Routine cocos2d::Ref::release() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCRef.cpp:146 (discriminator 1)
Stack frame #08  pc 00316cbd  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Vector<cocos2d::Node*>::clear()+14): Routine cocos2d::Vector<cocos2d::Node*>::clear() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCVector.h:396 (discriminator 1)
Stack frame #09  pc 0044abfd  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Node::~Node()+244): Routine _ZN7cocos2d6VectorIPNS_4NodeEED4Ev at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCVector.h:88
Stack frame #10  pc 004585c5  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::SpriteBatchNode::~SpriteBatchNode()+84): Routine cocos2d::SpriteBatchNode::~SpriteBatchNode() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:119 (discriminator 3)
Stack frame #11  pc 004585e9  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::SpriteBatchNode::~SpriteBatchNode()+4): Routine cocos2d::SpriteBatchNode::~SpriteBatchNode() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./2d/CCSpriteBatchNode.cpp:122
Stack frame #12  pc 00478997  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Ref::release()+30): Routine cocos2d::Ref::release() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCRef.cpp:146 (discriminator 1)
Stack frame #13  pc 00316cbd  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Vector<cocos2d::Node*>::clear()+14): Routine cocos2d::Vector<cocos2d::Node*>::clear() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCVector.h:396 (discriminator 1)
Stack frame #14  pc 0044abfd  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Node::~Node()+244): Routine _ZN7cocos2d6VectorIPNS_4NodeEED4Ev at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCVector.h:88
Stack frame #15  pc 00456e17  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Sprite::~Sprite()+170): Routine cocos2d::Sprite::~Sprite() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./2d/CCSprite.cpp:286 (discriminator 7)
Stack frame #16  pc 00456e41  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Sprite::~Sprite()+4): Routine cocos2d::Sprite::~Sprite() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./2d/CCSprite.cpp:296
Stack frame #17  pc 00478997  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Ref::release()+30): Routine cocos2d::Ref::release() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCRef.cpp:146 (discriminator 1)
Stack frame #18  pc 00316cbd  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Vector<cocos2d::Node*>::clear()+14): Routine cocos2d::Vector<cocos2d::Node*>::clear() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCVector.h:396 (discriminator 1)
Stack frame #19  pc 0044abfd  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Node::~Node()+244): Routine _ZN7cocos2d6VectorIPNS_4NodeEED4Ev at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCVector.h:88
Stack frame #20  pc 0045c197  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::TMXTiledMap::~TMXTiledMap()+130): Routine cocos2d::TMXTiledMap::~TMXTiledMap() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./2d/CCTMXTiledMap.cpp:97 (discriminator 3)
Stack frame #21  pc 00390303  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (TileMap::~TileMap()+26): Routine TileMap::~TileMap() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../Classes/model/TileMap.cpp:25 (discriminator 1)
Stack frame #22  pc 00390315  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (TileMap::~TileMap()+4): Routine TileMap::~TileMap() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../Classes/model/TileMap.cpp:30
Stack frame #23  pc 00478997  /data/app-lib/com.playbuff.BOWFinal-1/libcocos2dcpp.so (cocos2d::Ref::release()+30): Routine cocos2d::Ref::release() at /Users/PB037/Desktop/DKT/BOW-3.3-May11/BOWFinal/proj.android/jni/../../cocos2d/cocos/./base/CCRef.cpp:146 (discriminator 1)

问题是IOS设备上没有发生此崩溃,我找不到导致此崩溃的Node对象。请告诉我找到有缺陷Node的方法。谢谢。 PS:我也试过了ndk-r9d

0 个答案:

没有答案