xcode - EXC_BAD_ACCESS on deep NSString stringWithFormat: -
i'm writing mac os (10.8.4) app using xcode 5.1.1 own utilize (to solve 8 off solitaire game when stuck), , don't care efficiency or memory usage. it's recursive programme (it creates tree of possible moves, recurses, creates next move, etc.) needs lot of memory (i've got 24 gb) , i've increased stack (-wl,-stack_size,0x4000000). but, regardless of stack size, exc_bad_access code=2, @ same depth (about 170 levels), , it's on line uses nsstring stringwithformat: such as:
nsstring *temp = [nsstring stringwithformat:@"%d",value]; // value integer
the line has been executed fine in previous recursion levels. if remove particular line, exception happens @ other stringwithformat line. it's if nsstring has own limit, regardless of stack size setting. working earlier, when using garbage collection instead of arc. (xcode wanted me convert arc.)
i've checked zombies, there aren't objects beingness referenced on error lines anyway.
why might getting exc_bad_access regardless of stack size, , on stringwithformat:?
adding crash log:
process: eightoff solver [11701] path: /users/user/library/developer/xcode/deriveddata/eightoff_solver-dqppnsumvcsujjflailrgqxogyij/build/products/debug/eightoff solver.app/contents/macos/eightoff solver identifier: com.yourcompany.eightoff_solver version: 1.0 code type: x86-64 (native) parent process: launchd [179] user id: 501 date/time: 2014-06-25 01:38:46.581 -0500 os version: mac os x 10.8.4 (12e55) study version: 10 sleep/wake uuid: 561695d4-0498-43dc-9b0e-9417a5d5120d interval since lastly report: 60266 sec crashes since lastly report: 2 per-app crashes since lastly report: 9 anonymous uuid: 96f16b3c-9a73-63c2-b5cd-11cc51cfe612 crashed thread: 1 dispatch queue: com.apple.root.default-priority exception type: exc_bad_access (sigbus) exception codes: kern_protection_failure @ 0x0000000100400ec8 vm regions near 0x100400ec8: malloc_tiny 0000000100100000-0000000100400000 [ 3072k] rw-/rwx sm=prv --> stack guard 0000000100400000-0000000100401000 [ 4k] ---/rwx sm=nul stack guard thread 1 stack 0000000100401000-0000000100483000 [ 520k] rw-/rwx sm=cow thread 1 thread 0:: dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff8eb18686 mach_msg_trap + 10 1 libsystem_kernel.dylib 0x00007fff8eb17c42 mach_msg + 70 2 com.apple.corefoundation 0x00007fff93d38233 __cfrunloopservicemachport + 195 3 com.apple.corefoundation 0x00007fff93d3d916 __cfrunlooprun + 1078 4 com.apple.corefoundation 0x00007fff93d3d0e2 cfrunlooprunspecific + 290 5 com.apple.hitoolbox 0x00007fff93a36eb4 runcurrenteventloopinmode + 209 6 com.apple.hitoolbox 0x00007fff93a36c52 receivenexteventcommon + 356 7 com.apple.hitoolbox 0x00007fff93a36ae3 blockuntilnexteventmatchinglistinmode + 62 8 com.apple.appkit 0x00007fff9a52a533 _dpsnextevent + 685 9 com.apple.appkit 0x00007fff9a529df2 -[nsapplication nexteventmatchingmask:untildate:inmode:dequeue:] + 128 10 com.apple.appkit 0x00007fff9a5211a3 -[nsapplication run] + 517 11 com.apple.appkit 0x00007fff9a4c5bd6 nsapplicationmain + 869 12 com.yourcompany.eightoff_solver 0x0000000100006ea2 main + 34 (main.m:13) 13 com.yourcompany.eightoff_solver 0x0000000100001bc4 start + 52 thread 1 crashed:: dispatch queue: com.apple.root.default-priority 0 libsystem_c.dylib 0x00007fff936c682d __vfprintf + 40 1 libsystem_c.dylib 0x00007fff936c4e16 vsnprintf_l + 254 2 libsystem_c.dylib 0x00007fff936bf462 snprintf_l + 127 3 com.apple.corefoundation 0x00007fff93d0ef3f __cfstringappendformatcore + 11199 4 com.apple.corefoundation 0x00007fff93d594fb _cfstringcreatewithformatandargumentsaux + 107 5 com.apple.foundation 0x00007fff9a03f13c +[nsstring stringwithformat:] + 170 6 com.yourcompany.eightoff_solver 0x0000000100009b67 -[card description] + 663 (card.m:265) 7 com.yourcompany.eightoff_solver 0x00000001000091f7 -[card makenewgamestates:] + 9031 (card.m:211) 8 com.yourcompany.eightoff_solver 0x0000000100005087 -[mydocument recursiveongamestate:depth:] + 6903 (mydocument.m:1195) 9 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 10 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) ... [deleted identical lines numbered 11 through 170] 171 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 172 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 173 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 174 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 175 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 176 com.yourcompany.eightoff_solver 0x00000001000054b2 -[mydocument recursiveongamestate:depth:] + 7970 (mydocument.m:1210) 177 com.yourcompany.eightoff_solver 0x00000001000029c2 -[mydocument startbackgroundthread] + 2706 (mydocument.m:882) 178 com.apple.corefoundation 0x00007fff93d8f09c __invoking___ + 140 179 com.apple.corefoundation 0x00007fff93d8ef37 -[nsinvocation invoke] + 263 180 com.apple.foundation 0x00007fff9a07da30 -[nsinvocationoperation main] + 34 181 com.apple.foundation 0x00007fff9a075926 -[__nsoperationinternal start] + 684 182 com.apple.foundation 0x00007fff9a07d0f1 __block_global_6 + 129 183 libdispatch.dylib 0x00007fff96ec4f01 _dispatch_call_block_and_release + 15 184 libdispatch.dylib 0x00007fff96ec10b6 _dispatch_client_callout + 8 185 libdispatch.dylib 0x00007fff96ec21fa _dispatch_worker_thread2 + 304 186 libsystem_c.dylib 0x00007fff93654d0b _pthread_wqthread + 404 187 libsystem_c.dylib 0x00007fff9363f1d1 start_wqthread + 13 thread 2:: dispatch queue: com.apple.libdispatch-manager 0 libsystem_kernel.dylib 0x00007fff8eb1ad16 kevent + 10 1 libdispatch.dylib 0x00007fff96ec3dea _dispatch_mgr_invoke + 883 2 libdispatch.dylib 0x00007fff96ec39ee _dispatch_mgr_thread + 54 thread 3: 0 libsystem_kernel.dylib 0x00007fff8eb1a6d6 __workq_kernreturn + 10 1 libsystem_c.dylib 0x00007fff93654f4c _pthread_workq_return + 25 2 libsystem_c.dylib 0x00007fff93654d13 _pthread_wqthread + 412 3 libsystem_c.dylib 0x00007fff9363f1d1 start_wqthread + 13 thread 4: 0 libsystem_kernel.dylib 0x00007fff8eb1a6d6 __workq_kernreturn + 10 1 libsystem_c.dylib 0x00007fff93654f4c _pthread_workq_return + 25 2 libsystem_c.dylib 0x00007fff93654d13 _pthread_wqthread + 412 3 libsystem_c.dylib 0x00007fff9363f1d1 start_wqthread + 13 thread 5: 0 libsystem_kernel.dylib 0x00007fff8eb1a6d6 __workq_kernreturn + 10 1 libsystem_c.dylib 0x00007fff93654f4c _pthread_workq_return + 25 2 libsystem_c.dylib 0x00007fff93654d13 _pthread_wqthread + 412 3 libsystem_c.dylib 0x00007fff9363f1d1 start_wqthread + 13 thread 6: 0 libsystem_kernel.dylib 0x00007fff8eb1a6d6 __workq_kernreturn + 10 1 libsystem_c.dylib 0x00007fff93654f4c _pthread_workq_return + 25 2 libsystem_c.dylib 0x00007fff93654d13 _pthread_wqthread + 412 3 libsystem_c.dylib 0x00007fff9363f1d1 start_wqthread + 13 thread 1 crashed x86 thread state (64-bit): rax: 0x0000000000000208 rbx: 0x00007fff7ecb5a98 rcx: 0x00000001004014c0 rdx: 0x0000000100402d30 rdi: 0x0000000100401338 rsi: 0x00007fff7ecb5a98 rbp: 0x0000000100401250 rsp: 0x0000000100400e20 r8: 0x00000001004014c0 r9: 0x0000000000000003 r10: 0x0000000000000000 r11: 0x00000001004012b4 r12: 0x00000000000001ff r13: 0x0000000100401500 r14: 0x00000001004014c0 r15: 0x0000000100402d30 rip: 0x00007fff936c682d rfl: 0x0000000000010202 cr2: 0x0000000100400ec8 logical cpu: 0
6/30/14 edited add: started happening when upgraded xcode 5.1.1 (from 5.0). due changed build setting? (i don't know before.) i'm using imac (late 2012) intel core i5, os 10.8.4. of settings are: base of operations sdk: latest (i've tried restricting 10.8); valid architectures i386, x86_64 (i've tried having i386 or x86_64). deployment target: 10.8.
7/1/14 edited add: using nsoperationqueue (with dispatch_async on main queue ui operations). removing nsoperationqueue fixed crash, i'm unable ui update (nslog gives me output). executing loop in dispatch_async() background queue crashes, , 1 time again no ui updates. apparently, background tasks have resource limit related nsstring i'm unable change. crashes (always on creating nsstring) if don't update ui.
xcode osx nsstring exc-bad-access
No comments:
Post a Comment