[Solved] Upgraded from 3.8.1 to 3.15.1: EXC_BAD_ACCESS in random classes

[Solved] Upgraded from 3.8.1 to 3.15.1: EXC_BAD_ACCESS in random classes
0.0 0


Hi there,
I recently bought a new computer and thought that it might be good also to upgrade the cocos version from 3.8.1 to 3.15.1 to be up to date.

Currently on my old computer the game in development works without crashes both on iOs and Android using 3.8.1. On my new computer I downloaded 3.15.1, installed the required libraries, created a new project, opened it in XCode, moved all the required files from my old projects and installed fMOD and did the same in the android studio project.
Both projects compiled without an error and I was pleased that everything went so smoothly.

However when playing the game on devices after a random amount of time the game crashed with an EXC_BAD_ACCESS on Android and iOS.
The problem now is that this error occurs in random classes. Have a look at this screenshots:


The problem persists on iOS and Android, indicating that it has nothing to do with Andriod SDKs, NDK and other stuff.

Is there anybody that has an idea what I am doing wrong? It seems that somewhere memory is released that should not be released, but I have no clue how I could isolate this, as the error occurs each time in another class. Its also confusing because in 3.8.1 everything was running smoothly – no leaks, no EXC_BAD_ACCESS even after an hour of playing the game.

Any help will be appreciated :innocent:


could be missing asset, or many many different kind of errors in your code, maybe wrong spine version and so on…


Thx for your answer energyy
I am pretty sure that there are no assets or other stuff is missing :wink:
As said the code worked very well in 3.8.1 and it has about 10 screens including the main game screen.
I think somewhere and somehow memory that still belongs to objects is randomly released - and I don’t know how to detect that.

Have a look at that: Here I create a ParticleSystem when creating a new Scene. It usually always works even in 3.15.1. Out of the sudden it breaks like this:

I really have no idea what I am doing wrong :confounded:


Hi. Use OpenGL ES 2.
version 3.15.1 works with es 3 change it to version 2 and try again.


Thanks for the answer - I will give it a try :slight_smile:
Where can I change that?


If its not something in your code, check if your project has any precompiled binaries and which version of xcode/android-ndk you are using.

Sometimes compiled binaries from different versions of xcode/ndk are not compatible. Also, if different compiled components are using different C++ STL libraries etc, it can also cause problems with memory management.

Try using the latest xcode/ndk to rebuild all your binaries. Also check if your project or any dependencies are using a different C++ Standard Library compared to Cocos2dx default projects.


Thx, I only use fMOD as real library outside of cocos2d-x. I will try to remove it completly from my project and see if the error still persists.


edit - still not sure where it breaks :-C


Found it at last :slight_smile:
The errors were caused by some particle systems I use for simulating a goofy exhaust smoke of a motorbike.
According to the current torque of the engine I increase the emission rate of the particle systems in the update method of my custom physics body like this:


_exhaustSmokes in this case is a vector of the paritcleSystems.
When I accelerate and break for a few times in a row the emission rate changes very fast as the percent goes from 0 to 1 very quickly. Doing this causes this kind of behavior.

I don’t know if this is a bug. But it took me like two weeks to find out whats going on :sweat_smile: