terminate called after throwing an instance of 'std::bad_alloc' for cocos2d-x

Got this mysterious error when compiling and running on a iOS 3.1.3 device:
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc




The game would halt on any "new" calls to allocate memory.  The mystery was that the game worked fine in debug but in release it was throwing this error shown above.  It turns out that the Release configuration was using LLVM Compiler 2.0 while the Debug configuration was using LLVM GCC 4.2 for the cocos2d-x library build setting.

I switched the Release one to LLVM Compiler 2.0 and the game runs fine now on my iOS 3.1.3 device.  The issue doesn't occur for my iOS 4.1 device so it looks like it was a mysterious compiler issue that caused this bug for my iOS 3.1.3 device.

Comments

Popular Posts