0

Executing

`boost::thread(boost::bind(&SomeClass::someStaticFunction, someParam));` 

sometimes causing a crash. Please notice that the function is static. The trace I see is:

* thread #35: tid = 0x2a822, 0x00d2469e NdsVgconnectTestApp`boost::(anonymous namespace)::thread_proxy(param=<unavailable>) + 246 at thread.cpp:164, stop reason = EXC_BAD_ACCESS (code=1, address=0x20000008)
  * frame #0: 0x00d2469e NdsVgconnectTestApp`boost::(anonymous namespace)::thread_proxy(param=<unavailable>) + 246 at thread.cpp:164
    frame #1: 0x3b877918 libsystem_pthread.dylib`_pthread_body + 140
    frame #2: 0x3b87788a libsystem_pthread.dylib`_pthread_start + 102

What could be the possible reasons for the EXC_BAD_ACCESS? Could it happen due to too many threads or memory allocation overrun (it was 54 threads when the app crashed) ?

Sanich
  • 1,739
  • 6
  • 25
  • 43
  • Is this error saying the function crashed? What's in the function? Are you just running it on one thread? – doctorlove Oct 08 '14 at 12:19
  • @doctorlove I'm running an application on iPad. From logs and call stack I can see that the crash occurred after the mentioned line. As I said, there were 54 threads when the crash occurred. – Sanich Oct 08 '14 at 12:24
  • And all 54 threads were calling this static function (which I can't see the code for)? I suspect the `stop reason = EXC_BAD_ACCESS` means you are accessing memory your shouldn't. It could be array sizes, or an initialisation problem/race condition. Hard to say from here. – doctorlove Oct 08 '14 at 12:38
  • The crash occurs in boost code in thread.cpp file. The working function passed to boost::thread wasn't executed yet. – Sanich Oct 08 '14 at 13:37
  • @doctorlove my reply above – Sanich Oct 12 '14 at 10:59

0 Answers0