Android crash reference count should greater than 0

My game crash on android and I can’t figure out what went wrong even though I was debugging it but suddenly it crash and here is the logcat output is there any hint why this happen?

D/cocos2d-x debug info: Assert failed: reference count should greater than 0
E/cocos2d-x assert:/cocos2d-x-2.2.6/cocos2dx/cocoa/CCObject.cpp function:retain line:95

    --------- beginning of crash
A/libc: Fatal signal 11 (SIGSEGV), code 128, fault addr 0x0 in tid 2388 (app)
E/InputDispatcher: channel '32b29eb0 packagename/packagename.testapp (server)' ~ Channel is unrecoverably broken and will be disposed!
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824

E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/cocos2d-x assert: /cocos2d-x-2.2.6/cocos2dx/cocoa/CCObject.cpp function:retain line:95
A/libc: Fatal signal 11 (SIGSEGV), code 128, fault addr 0x0 in tid 2613 (app)
E/InputDispatcher: channel '947ae0f package/package.testapp (server)' ~ Channel is unrecoverably broken and will be disposed!`

Do you manually call retain, release?
Probably you call release when should not.

Maybe, Is there any way to find out where that happened?

If it crashed during debugging then you should see callstack and analyze your code.

In the past this has required me to step through my code using a debugger, line by line and I manually made a chart on a piece of paper to see when I retained and released and I literally wrote and crossed off until I found I had to cross off twice. (meaning releasing twice from a single retain.)

Old school problems…

1 Like